diff --git a/Source/Debug/ExceptionWatcher.Win32.cpp b/Source/Debug/ExceptionWatcher.Win32.cpp index 82e4c204..c267b06c 100644 --- a/Source/Debug/ExceptionWatcher.Win32.cpp +++ b/Source/Debug/ExceptionWatcher.Win32.cpp @@ -31,6 +31,8 @@ #include #endif +#include + static thread_local int gDebugLocked = 0; namespace Aurora::Debug @@ -206,6 +208,21 @@ namespace Aurora::Debug }; StackTrace backtrace; + + BOOL bLocked {}; + if (AuxUlibIsDLLSynchronizationHeld(&bLocked)) + { + if (bLocked) + { + ParseStack(ExceptionInfo->ContextRecord, backtrace); + + AuLogWarn("DLL Load NT Exception: 0x{:x}", ExceptionInfo->ExceptionRecord->ExceptionCode); + AuLogWarn("{}", StringifyStackTrace(backtrace)); + gDebugLocked = 0; + return EXCEPTION_CONTINUE_SEARCH; + } + } + { static bool bRunOnce {}; struct ArrowEx : Grug::Arrow @@ -245,9 +262,16 @@ namespace Aurora::Debug CONTEXT ctx {}; ctx.ContextFlags = CONTEXT_ALL; - if (!GetThreadContext(GetCurrentThread(), &ctx)) + if (ExceptionInfo->ContextRecord) { - Debug::Panic(); + ctx = *ExceptionInfo->ContextRecord; + } + else + { + if (!GetThreadContext(GetCurrentThread(), &ctx)) + { + Debug::Panic(); + } } AuVoidFunc doReportLocal;