mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +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_URL { CMAKE_BACKTRACE_URL };
|
||||||
static const std::string BACKTRACE_TOKEN { CMAKE_BACKTRACE_TOKEN };
|
static const std::string BACKTRACE_TOKEN { CMAKE_BACKTRACE_TOKEN };
|
||||||
|
|
||||||
|
static std::wstring gIPCPipe;
|
||||||
|
|
||||||
extern QString qAppFileName();
|
extern QString qAppFileName();
|
||||||
|
|
||||||
// crashpad::AnnotationList* crashpadAnnotations { nullptr };
|
// 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() {
|
bool startCrashHandler() {
|
||||||
if (BACKTRACE_URL.empty() || BACKTRACE_TOKEN.empty()) {
|
if (BACKTRACE_URL.empty() || BACKTRACE_TOKEN.empty()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -76,7 +106,12 @@ bool startCrashHandler() {
|
||||||
// Enable automated uploads.
|
// Enable automated uploads.
|
||||||
database->GetSettings()->SetUploadsEnabled(true);
|
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) {
|
void setCrashAnnotation(std::string name, std::string value) {
|
||||||
|
|
Loading…
Reference in a new issue