actually fix windows exception handling

This commit is contained in:
dank_meme 2023-10-25 00:18:58 +02:00
parent 52421d8c65
commit 0472075f88
2 changed files with 13 additions and 4 deletions

View file

@ -254,7 +254,7 @@ static std::string getInfo(LPEXCEPTION_POINTERS info, Mod* faultyMod) {
}
static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) {
SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
// init symbols so we can get some juicy debug info
@ -272,8 +272,17 @@ static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) {
return EXCEPTION_CONTINUE_SEARCH;
}
bool crashlog::setupPlatformHandler() {
static LONG WINAPI exceptionHandlerDummy(LPEXCEPTION_POINTERS info) {
SetUnhandledExceptionFilter(exceptionHandler);
return EXCEPTION_CONTINUE_SEARCH;
}
bool crashlog::setupPlatformHandler() {
// for some reason, on exceptions windows seems to clear SetUnhandledExceptionFilter
// so we attach a VE handler (which runs *earlier*) and inside set our crash handler
AddVectoredExceptionHandler(0, exceptionHandlerDummy);
SetUnhandledExceptionFilter(exceptionHandler);
auto lastCrashedFile = crashlog::getCrashLogDirectory() / "last-crashed";
if (ghc::filesystem::exists(lastCrashedFile)) {
g_lastLaunchCrashed = true;

View file

@ -6,7 +6,7 @@
// We define them manually in order to be able to use them.
// source: https://www.geoffchappell.com/studies/msvc/language/predefined/index.htm
#if defined(__GNUC__) || defined(__clang__)
#if defined(__GNUC__) || defined(__clang__) || defined(__INTELLISENSE__)
typedef struct _PMD
{
@ -50,6 +50,6 @@ typedef const struct _s__ThrowInfo {
_CatchableTypeArray *pCatchableTypeArray;
} _ThrowInfo;
#endif // defined(__GNUC__) || defined(__clang__)
#endif // defined(__GNUC__) || defined(__clang__) || defined(__INTELLISENSE__)
#include <ehdata.h> // for EH_EXCEPTION_NUMBER