[*] fix stack-overflow reporting

This commit is contained in:
Reece Wilson 2023-05-31 07:15:55 +01:00
parent b423ce14b1
commit ce424388aa

View File

@ -201,49 +201,80 @@ namespace Aurora::Debug
}
};
StackTrace backtrace;
ParseStack(ExceptionInfo->ContextRecord, backtrace);
#if defined(_AU_USE_EXTENDED_FWD_FACING_DEBUGGING)
bool isInternal = true;
#else
bool isInternal = false;
#endif
if (pThrowInfo)
{
ReportSEH(handle, exception, pThrowInfo, handleNoCppObject, backtrace, [&](const AuString &str)
static bool bRunOnce {};
struct ArrowEx : Grug::Arrow
{
// Pre-submit callback -> its showtime
if ((isCritical || isInternal) && (minimal == 0))
AuFunction<void()> callback;
};
ArrowEx empty;
empty.callback = [&]()
{
try
{
if (gRuntimeConfig.debug.bPrintExceptionStackTracesOut)
if (AuExchange(bRunOnce, true))
{
AuLogWarn("NT Exception: 0x{:x}, {}", ExceptionInfo->ExceptionRecord->ExceptionCode, str);
AuLogWarn("{}", StringifyStackTrace(backtrace));
Telemetry::Mayday();
PlatformHandleFatal(true);
}
StackTrace backtrace;
ParseStack(ExceptionInfo->ContextRecord, backtrace);
#if defined(AU_CFG_ID_INTERNAL) || defined(AU_CFG_ID_DEBUG)
const bool kShouldPrintErrors = true;
#else
const bool kShouldPrintErrors = false;
#endif
if (pThrowInfo)
{
ReportSEH(handle, exception, pThrowInfo, handleNoCppObject, backtrace, [&](const AuString &str)
{
// Pre-submit callback -> its showtime
if ((isCritical || kShouldPrintErrors) && (minimal == 0))
{
if (gRuntimeConfig.debug.bPrintExceptionStackTracesOut)
{
AuLogWarn("NT Exception: 0x{:x}, {}", ExceptionInfo->ExceptionRecord->ExceptionCode, str);
AuLogWarn("{}", StringifyStackTrace(backtrace));
}
}
});
}
}
});
}
catch (...)
{
try
{
Grug::Arrow empty;
Grug::HurlRaiseProblematicEvent(&empty);
}
if (isCritical)
try
{
if (isCritical)
{
Telemetry::Mayday();
}
if (isCritical || gRuntimeConfig.debug.bIsExceptionThrowFatal) // exception = literally anything
{
PlatformHandleFatal(true);
}
}
catch (...)
{
}
};
empty.pCallback =[](Grug::Arrow *pBase) -> void
{
Telemetry::Mayday();
}
if (isCritical || gRuntimeConfig.debug.bIsExceptionThrowFatal) // exception = literally anything
{
PlatformHandleFatal(true);
}
}
catch (...)
{
auto pEx = (ArrowEx *)pBase;
pEx->callback();
};
Grug::HurlArrow(&empty, empty.pCallback, {});
Grug::ArrowWait(&empty);
}
gDebugLocked = 0;
@ -344,7 +375,14 @@ namespace Aurora::Debug
}
__fastfail('fokd');
if (AuSwInfo::IsWindows8Point1OrGreater())
{
__fastfail('fokd');
}
else
{
ExitProcess(0);
}
}
}
#endif