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

54
accelerator.games.txt Normal file
View File

@ -0,0 +1,54 @@
"Games"
{
"#default"
{
"Signatures"
{
/*
* String: "\nConsole History (reversed)\n\n"
* It's the function in the following branch.
*/
"GetSpew"
{
"library" "engine"
"linux" "@_Z7GetSpewPcj"
}
}
}
"tf"
{
"Signatures"
{
"GetSpew"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x20\x8D\x45\xE0\x57"
}
}
}
"cstrike"
{
"Signatures"
{
"GetSpew"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x53\xFF\x15\x2A\x2A\x2A\x2A\x8B\xD0"
}
}
}
"csgo"
{
"Signatures"
{
"GetSpew"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x08\x56\x57\x8B\xFA\x89\x4D\xFC"
}
}
}
}

View File

@ -67,12 +67,16 @@ class CopyFile(Command):
shutil.copy(self.fromFile, self.toPath)
folders = [['addons', 'sourcemod', 'extensions']]
folders = [
['addons', 'sourcemod', 'gamedata'],
['addons', 'sourcemod', 'extensions'],
]
#Setup
job.AddCommand(DestroyPath(os.path.join(AMBuild.outputFolder, 'package')))
job.AddCommand(CreateFolders(folders))
job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'accelerator.games.txt'), os.path.join('addons', 'sourcemod', 'gamedata')))
job.AddCommand(CopyFile(os.path.join(AMBuild.sourceFolder, 'accelerator.autoload'), os.path.join('addons', 'sourcemod', 'extensions')))
bincopies = []

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);

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

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

View File

@ -1 +1 @@
2.1.0
2.2.0