Add more metadata to dump files

This commit is contained in:
Asher Baker 2016-01-25 15:38:43 +00:00
parent 96236d2666
commit 4570405649
6 changed files with 98 additions and 4 deletions

View File

@ -2,6 +2,19 @@
{
"#default"
{
"Offsets"
{
/*
* This has never changed, let us hope it never does.
*/
"GetCmdLine"
{
"windows" "2"
"linux" "2"
"mac" "2"
}
}
"Signatures"
{
/*

View File

@ -48,6 +48,13 @@ GetSpew_t GetSpew;
char spewBuffer[65536]; // Hi.
char crashMap[256];
char crashGamePath[512];
char crashCommandLine[1024];
char crashSourceModPath[512];
char crashGameDirectory[256];
char crashExtensionVersion[32];
char dumpStoragePath[512];
char logPath[512];
@ -104,6 +111,21 @@ static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
return succeeded;
}
sys_write(extra, "-------- CONFIG BEGIN --------", 30);
sys_write(extra, "\nMap=", 5);
sys_write(extra, crashMap, my_strlen(crashMap));
sys_write(extra, "\nGamePath=", 10);
sys_write(extra, crashGamePath, my_strlen(crashGamePath));
sys_write(extra, "\nCommandLine=", 13);
sys_write(extra, crashCommandLine, my_strlen(crashCommandLine));
sys_write(extra, "\nSourceModPath=", 15);
sys_write(extra, crashSourceModPath, my_strlen(crashSourceModPath));
sys_write(extra, "\nGameDirectory=", 15);
sys_write(extra, crashGameDirectory, my_strlen(crashGameDirectory));
sys_write(extra, "\nExtensionVersion=", 18);
sys_write(extra, crashExtensionVersion, my_strlen(crashExtensionVersion));
sys_write(extra, "\n-------- CONFIG END --------\n", 30);
if (GetSpew) {
GetSpew(spewBuffer, sizeof(spewBuffer));
sys_write(extra, "-------- CONSOLE HISTORY BEGIN --------\n", 40);
@ -440,6 +462,10 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late)
delete i;
#endif
if (late) {
this->OnCoreMapStart(NULL, 0, 0);
}
return true;
}
@ -458,3 +484,50 @@ void Accelerator::SDK_OnUnload()
delete handler;
}
class VFuncEmptyClass {};
const char *GetCmdLine()
{
static int getCmdLineOffset = 0;
if (getCmdLineOffset == 0) {
if (!gameconfig->GetOffset("GetCmdLine", &getCmdLineOffset)) {
return "";
}
if (getCmdLineOffset == 0) {
return "";
}
}
void *cmdline = gamehelpers->GetValveCommandLine();
void **vtable = *(void ***)cmdline;
void *vfunc = vtable[getCmdLineOffset];
union {
const char *(VFuncEmptyClass::*mfpnew)();
#ifndef WIN32
struct {
void *addr;
intptr_t adjustor;
} s;
} u;
u.s.addr = vfunc;
u.s.adjustor = 0;
#else
void *addr;
} u;
u.addr = vfunc;
#endif
return (const char *)(reinterpret_cast<VFuncEmptyClass*>(cmdline)->*u.mfpnew)();
}
void Accelerator::OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax)
{
strncpy(crashMap, gamehelpers->GetCurrentMap(), sizeof(crashMap) - 1);
strncpy(crashGamePath, g_pSM->GetGamePath(), sizeof(crashGamePath) - 1);
strncpy(crashCommandLine, GetCmdLine(), sizeof(crashCommandLine) - 1);
strncpy(crashSourceModPath, g_pSM->GetSourceModPath(), sizeof(crashSourceModPath) - 1);
strncpy(crashGameDirectory, g_pSM->GetGameFolderName(), sizeof(crashGameDirectory) - 1);
strncpy(crashExtensionVersion, SMEXT_CONF_VERSION, sizeof(crashExtensionVersion) - 1);
}

View File

@ -96,6 +96,14 @@ public:
*/
//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlen);
#endif
/**
* @brief Called on server activation before plugins receive the OnServerLoad forward.
*
* @param pEdictList Edicts list.
* @param edictCount Number of edicts in the list.
* @param clientMax Maximum number of clients allowed in the server.
*/
virtual void OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
};
#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_

View File

@ -64,7 +64,7 @@
//#define SMEXT_ENABLE_DBMANAGER
#define SMEXT_ENABLE_GAMECONF
//#define SMEXT_ENABLE_MEMUTILS
//#define SMEXT_ENABLE_GAMEHELPERS
#define SMEXT_ENABLE_GAMEHELPERS
//#define SMEXT_ENABLE_TIMERSYS
#define SMEXT_ENABLE_THREADER
#define SMEXT_ENABLE_LIBSYS

View File

@ -18,9 +18,9 @@
#define SM_BUILD_TAG "-manual"
#define SM_BUILD_UNIQUEID "[MANUAL BUILD]"
#define SM_VERSION "2.2.0"
#define SM_VERSION "2.2.1"
#define SM_FULL_VERSION SM_VERSION SM_BUILD_TAG
#define SM_FILE_VERSION 2,2,0,0
#define SM_FILE_VERSION 2,2,1,0
#endif

View File

@ -1 +1 @@
2.2.0
2.2.1