mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 01:36:56 +02:00
realizing the current logic is catching first-chance exceptions
This commit is contained in:
parent
b6e1c9e3af
commit
033726fc64
1 changed files with 21 additions and 10 deletions
|
@ -148,26 +148,32 @@ static constexpr DWORD STATUS_MSVC_CPP_EXCEPTION = 0xE06D7363;
|
||||||
static constexpr ULONG_PTR MSVC_CPP_EXCEPTION_SIGNATURE = 0x19930520;
|
static constexpr ULONG_PTR MSVC_CPP_EXCEPTION_SIGNATURE = 0x19930520;
|
||||||
static constexpr int ANNOTATION_LOCK_WEAK_ATTEMPT = 5000; // attempt to lock the annotations list, but give up if it takes more than 5 seconds
|
static constexpr int ANNOTATION_LOCK_WEAK_ATTEMPT = 5000; // attempt to lock the annotations list, but give up if it takes more than 5 seconds
|
||||||
|
|
||||||
|
LPTOP_LEVEL_EXCEPTION_FILTER gl_nextUnhandledExceptionFilter = nullptr;
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
void fatalCxxException(PEXCEPTION_POINTERS pExceptionInfo);
|
void fatalCxxException(PEXCEPTION_POINTERS pExceptionInfo);
|
||||||
|
|
||||||
LONG WINAPI vectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) {
|
LONG WINAPI firstChanceExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) {
|
||||||
if (!client) {
|
if (client && (pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_HEAP_CORRUPTION ||
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_STACK_BUFFER_OVERRUN)) {
|
||||||
}
|
|
||||||
|
|
||||||
if (pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_HEAP_CORRUPTION ||
|
|
||||||
pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_STACK_BUFFER_OVERRUN) {
|
|
||||||
client->DumpAndCrash(pExceptionInfo);
|
client->DumpAndCrash(pExceptionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_MSVC_CPP_EXCEPTION) {
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG WINAPI unhandledExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) {
|
||||||
|
if (client && pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_MSVC_CPP_EXCEPTION) {
|
||||||
fatalCxxException(pExceptionInfo);
|
fatalCxxException(pExceptionInfo);
|
||||||
client->DumpAndCrash(pExceptionInfo);
|
client->DumpAndCrash(pExceptionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gl_nextUnhandledExceptionFilter != nullptr) {
|
||||||
|
return gl_nextUnhandledExceptionFilter(pExceptionInfo);
|
||||||
|
}
|
||||||
|
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,11 +329,16 @@ bool startCrashHandler(std::string appPath) {
|
||||||
// Enable automated uploads.
|
// Enable automated uploads.
|
||||||
database->GetSettings()->SetUploadsEnabled(true);
|
database->GetSettings()->SetUploadsEnabled(true);
|
||||||
|
|
||||||
|
if (!client->StartHandler(handler, db, db, BACKTRACE_URL, annotations, arguments, true, true)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
AddVectoredExceptionHandler(0, vectoredExceptionHandler);
|
AddVectoredExceptionHandler(0, firstChanceExceptionHandler);
|
||||||
|
gl_nextUnhandledExceptionFilter = SetUnhandledExceptionFilter(unhandledExceptionHandler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return client->StartHandler(handler, db, db, BACKTRACE_URL, annotations, arguments, true, true);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCrashAnnotation(std::string name, std::string value) {
|
void setCrashAnnotation(std::string name, std::string value) {
|
||||||
|
|
Loading…
Reference in a new issue