mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-30 10:43:12 +02:00
Add special handler for heap corruption
This commit is contained in:
parent
bd59ff1573
commit
a626e9f6f3
1 changed files with 36 additions and 1 deletions
|
@ -31,10 +31,40 @@ using namespace crashpad;
|
|||
static const std::string BACKTRACE_URL { CMAKE_BACKTRACE_URL };
|
||||
static const std::string BACKTRACE_TOKEN { CMAKE_BACKTRACE_TOKEN };
|
||||
|
||||
static std::wstring gIPCPipe;
|
||||
|
||||
extern QString qAppFileName();
|
||||
|
||||
// crashpad::AnnotationList* crashpadAnnotations { nullptr };
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
LONG WINAPI vectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) {
|
||||
if (pExceptionInfo->ExceptionRecord->ExceptionCode == 0xe06d7363) { // external exception
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
if (pExceptionInfo->ExceptionRecord->ExceptionCode == 0xc0000374) { // heap corruption
|
||||
qCritical() << "VectoredExceptionHandler";
|
||||
qCritical() << QString::number(pExceptionInfo->ExceptionRecord->ExceptionCode, 16);
|
||||
qCritical() << "Heap corruption!";
|
||||
|
||||
CrashpadClient client;
|
||||
if (gIPCPipe.length()) {
|
||||
|
||||
bool rc = client.SetHandlerIPCPipe(gIPCPipe);
|
||||
qCritical() << "SetHandlerIPCPipe = " << rc;
|
||||
} else {
|
||||
qCritical() << "No IPC Pipe was previously defined for crash handler.";
|
||||
}
|
||||
qCritical() << "Calling DumpAndCrash()";
|
||||
client.DumpAndCrash(pExceptionInfo);
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
bool startCrashHandler() {
|
||||
if (BACKTRACE_URL.empty() || BACKTRACE_TOKEN.empty()) {
|
||||
return false;
|
||||
|
@ -76,7 +106,12 @@ bool startCrashHandler() {
|
|||
// Enable automated uploads.
|
||||
database->GetSettings()->SetUploadsEnabled(true);
|
||||
|
||||
return client.StartHandler(handler, db, db, BACKTRACE_URL, annotations, arguments, true, true);
|
||||
bool result = client.StartHandler(handler, db, db, BACKTRACE_URL, annotations, arguments, true, true);
|
||||
gIPCPipe = client.GetHandlerIPCPipe();
|
||||
|
||||
AddVectoredExceptionHandler(0, vectoredExceptionHandler);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void setCrashAnnotation(std::string name, std::string value) {
|
||||
|
|
Loading…
Reference in a new issue