Add plugin version to debug trace information (bug 3649, r=joropito)

Former-commit-id: 9bfdce3738
This commit is contained in:
Vincent HERBET 2013-06-17 17:49:20 +02:00
parent a1306b8d96
commit 525c45e9f5
2 changed files with 22 additions and 2 deletions

View File

@ -562,8 +562,9 @@ void Debugger::DisplayTrace(const char *message)
FormatError(buffer, sizeof(buffer)-1); FormatError(buffer, sizeof(buffer)-1);
const char *filename = _GetFilename(); const char *filename = _GetFilename();
const char *version = _GetVersion();
AMXXLOG_Error("[AMXX] Displaying debug trace (plugin \"%s\")", filename); AMXXLOG_Error("[AMXX] Displaying debug trace (plugin \"%s\", version \"%s\")", filename, version);
AMXXLOG_Error("[AMXX] %s", buffer); AMXXLOG_Error("[AMXX] %s", buffer);
int count = 0; int count = 0;
@ -605,6 +606,23 @@ const char *Debugger::_GetFilename()
return m_FileName.c_str(); return m_FileName.c_str();
} }
const char *Debugger::_GetVersion()
{
if (m_Version.size() < 1)
{
const char *version = "";
CPluginMngr::CPlugin *pl = g_plugins.findPluginFast(m_pAmx);
if (pl)
{
version = pl->getVersion();
}
m_Version.assign(version);
}
return m_Version.c_str();
}
void Debugger::FmtGenericMsg(AMX *amx, int error, char buffer[], size_t maxLength) void Debugger::FmtGenericMsg(AMX *amx, int error, char buffer[], size_t maxLength)
{ {
const char *filename = ""; const char *filename = "";

View File

@ -138,6 +138,7 @@ private:
cell _CipAsVa(cell cip); cell _CipAsVa(cell cip);
const char *_GetFilename(); const char *_GetFilename();
const char *_GetVersion();
public: public:
AMX *m_pAmx; AMX *m_pAmx;
AMX_DBG *m_pAmxDbg; AMX_DBG *m_pAmxDbg;
@ -145,6 +146,7 @@ public:
int m_Top; int m_Top;
cell *m_pOpcodeList; cell *m_pOpcodeList;
String m_FileName; String m_FileName;
String m_Version;
CVector<Tracer *> m_pCalls; CVector<Tracer *> m_pCalls;
}; };