[*] minor win32 exception handling improvements

(80faead5, ce424388 cont)
This commit is contained in:
Reece Wilson 2023-06-24 20:43:32 +01:00
parent 4c72a20ba2
commit 07720f0379
2 changed files with 25 additions and 8 deletions

View File

@ -175,15 +175,12 @@ namespace Aurora::Debug
BlackboxReport(pExceptionInfo, true);
#endif
}
void PlatformHandleFatalEx2(bool fatal, CONTEXT &ctx, bool bNoExit);
void PlatformHandleFatal(bool fatal, bool bNoExit)
{
static bool forceFail {false};
_EXCEPTION_POINTERS ptrs;
StackTrace ret;
CONTEXT ctx {};
EXCEPTION_RECORD ex {};
ctx.ContextFlags = CONTEXT_ALL;
if (!GetThreadContext(GetCurrentThread(), &ctx))
@ -191,6 +188,16 @@ namespace Aurora::Debug
Debug::Panic();
}
PlatformHandleFatalEx2(fatal, ctx, bNoExit);
}
void PlatformHandleFatalEx2(bool fatal, CONTEXT & ctx, bool bNoExit)
{
static bool forceFail { false };
_EXCEPTION_POINTERS ptrs;
StackTrace ret;
EXCEPTION_RECORD ex {};
if (!bNoExit)
{
if (!AuExchange(forceFail, true))
@ -200,7 +207,7 @@ namespace Aurora::Debug
}
ex.ExceptionCode = 0x1337;
ptrs.ExceptionRecord = &ex;
ptrs.ContextRecord = &ctx;

View File

@ -89,6 +89,8 @@ namespace Aurora::Debug
};
#undef EXCEPTION_ENTRY
void PlatformHandleFatalEx2(bool fatal, CONTEXT &ctx, bool bNoExit);
static bool IsReadable(const void *address)
{
MEMORY_BASIC_INFORMATION info;
@ -237,6 +239,15 @@ namespace Aurora::Debug
Grug::ArrowWait(&empty);
}
CONTEXT ctx {};
ctx.ContextFlags = CONTEXT_ALL;
if (!GetThreadContext(GetCurrentThread(), &ctx))
{
Debug::Panic();
}
AuVoidFunc doReportLocal;
{
@ -291,7 +302,7 @@ namespace Aurora::Debug
}
else
{
PlatformHandleFatal(false);
PlatformHandleFatalEx2(false, ctx, true);
}
}
catch (...)
@ -407,7 +418,6 @@ namespace Aurora::Debug
{
}
if (AuSwInfo::IsWindows8Point1OrGreater())
{
__fastfail('fokd');