Include console logs in Linux crash reports.

This commit is contained in:
Asher Baker
2016-01-13 16:25:03 +00:00
parent b24de4743c
commit 2319e8b926
6 changed files with 99 additions and 10 deletions
+33 -2
View File
@@ -41,7 +41,12 @@ Accelerator g_accelerator;
SMEXT_LINK(&g_accelerator);
IWebternet *webternet;
static IThreadHandle *uploadThread;
IGameConfig *gameconfig;
typedef void (*GetSpew_t)(char *buffer, unsigned int length);
GetSpew_t GetSpew;
char spewBuffer[65536]; // Hi.
char buffer[512];
google_breakpad::ExceptionHandler *handler = NULL;
@@ -73,10 +78,19 @@ static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
{
//printf("Wrote minidump to: %s\n", descriptor.path());
sys_write(STDOUT_FILENO, "Wrote minidump to: ", 19);
if (succeeded) {
sys_write(STDOUT_FILENO, "Wrote minidump to: ", 19);
} else {
sys_write(STDOUT_FILENO, "Failed to write minidump to: ", 29);
}
sys_write(STDOUT_FILENO, descriptor.path(), my_strlen(descriptor.path()));
sys_write(STDOUT_FILENO, "\n", 1);
if (!succeeded) {
return succeeded;
}
my_strlcpy(buffer, descriptor.path(), sizeof(buffer));
my_strlcat(buffer, ".txt", sizeof(buffer));
@@ -86,6 +100,13 @@ static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
return succeeded;
}
if (GetSpew) {
GetSpew(spewBuffer, sizeof(spewBuffer));
sys_write(extra, "-------- CONSOLE HISTORY BEGIN --------\n", 40);
sys_write(extra, spewBuffer, my_strlen(spewBuffer));
sys_write(extra, "-------- CONSOLE HISTORY END --------\n", 38);
}
char pis[64];
char pds[32];
for (unsigned i = 0; i < plugin_count; ++i) {
@@ -315,6 +336,16 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late)
}
}
if (!gameconfs->LoadGameConfigFile("accelerator.games", &gameconfig, error, maxlength)) {
return false;
}
if (!gameconfig->GetMemSig("GetSpew", (void **)&GetSpew)) {
smutils->LogError(myself, "WARNING: GetSpew not found in gamedata, console output will not be included in crash reports.");
} else if (!GetSpew) {
smutils->LogError(myself, "WARNING: Sigscan for GetSpew failed, console output will not be included in crash reports.");
}
#if defined _LINUX
google_breakpad::MinidumpDescriptor descriptor(buffer);
handler = new google_breakpad::ExceptionHandler(descriptor, NULL, dumpCallback, NULL, true, -1);
+4 -4
View File
@@ -38,10 +38,10 @@
/* Basic information exposed publicly */
#define SMEXT_CONF_NAME "Accelerator"
#define SMEXT_CONF_DESCRIPTION "Take back control"
#define SMEXT_CONF_DESCRIPTION "SRCDS Crash Handler"
#define SMEXT_CONF_VERSION SM_FULL_VERSION
#define SMEXT_CONF_AUTHOR "Asher \"asherkin\" Baker"
#define SMEXT_CONF_URL "http://limetech.org/"
#define SMEXT_CONF_URL "https://crash.limetech.org/"
#define SMEXT_CONF_LOGTAG "CRASH"
#define SMEXT_CONF_LICENSE "GPL"
#define SMEXT_CONF_DATESTRING __DATE__
@@ -62,11 +62,11 @@
//#define SMEXT_ENABLE_HANDLESYS
//#define SMEXT_ENABLE_PLAYERHELPERS
//#define SMEXT_ENABLE_DBMANAGER
//#define SMEXT_ENABLE_GAMECONF
#define SMEXT_ENABLE_GAMECONF
//#define SMEXT_ENABLE_MEMUTILS
//#define SMEXT_ENABLE_GAMEHELPERS
//#define SMEXT_ENABLE_TIMERSYS
#define SMEXT_ENABLE_THREADER
//#define SMEXT_ENABLE_THREADER
#define SMEXT_ENABLE_LIBSYS
//#define SMEXT_ENABLE_MENUS
//#define SMEXT_ENABLE_ADTFACTORY
+2 -2
View File
@@ -18,9 +18,9 @@
#define SM_BUILD_TAG "-manual"
#define SM_BUILD_UNIQUEID "[MANUAL BUILD]"
#define SM_VERSION "2.0.1"
#define SM_VERSION "2.2.0"
#define SM_FULL_VERSION SM_VERSION SM_BUILD_TAG
#define SM_FILE_VERSION 2,0,1,0
#define SM_FILE_VERSION 2,2,0,0
#endif