[*] 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,13 +201,31 @@ namespace Aurora::Debug
}
};
{
static bool bRunOnce {};
struct ArrowEx : Grug::Arrow
{
AuFunction<void()> callback;
};
ArrowEx empty;
empty.callback = [&]()
{
try
{
if (AuExchange(bRunOnce, true))
{
Telemetry::Mayday();
PlatformHandleFatal(true);
}
StackTrace backtrace;
ParseStack(ExceptionInfo->ContextRecord, backtrace);
#if defined(_AU_USE_EXTENDED_FWD_FACING_DEBUGGING)
bool isInternal = true;
#if defined(AU_CFG_ID_INTERNAL) || defined(AU_CFG_ID_DEBUG)
const bool kShouldPrintErrors = true;
#else
bool isInternal = false;
const bool kShouldPrintErrors = false;
#endif
if (pThrowInfo)
@ -215,7 +233,7 @@ namespace Aurora::Debug
ReportSEH(handle, exception, pThrowInfo, handleNoCppObject, backtrace, [&](const AuString &str)
{
// Pre-submit callback -> its showtime
if ((isCritical || isInternal) && (minimal == 0))
if ((isCritical || kShouldPrintErrors) && (minimal == 0))
{
if (gRuntimeConfig.debug.bPrintExceptionStackTracesOut)
{
@ -225,12 +243,14 @@ namespace Aurora::Debug
}
});
}
}
catch (...)
{
}
try
{
Grug::Arrow empty;
Grug::HurlRaiseProblematicEvent(&empty);
if (isCritical)
{
Telemetry::Mayday();
@ -245,6 +265,17 @@ namespace Aurora::Debug
{
}
};
empty.pCallback =[](Grug::Arrow *pBase) -> void
{
auto pEx = (ArrowEx *)pBase;
pEx->callback();
};
Grug::HurlArrow(&empty, empty.pCallback, {});
Grug::ArrowWait(&empty);
}
gDebugLocked = 0;
return EXCEPTION_CONTINUE_SEARCH;
@ -344,8 +375,15 @@ namespace Aurora::Debug
}
if (AuSwInfo::IsWindows8Point1OrGreater())
{
__fastfail('fokd');
}
else
{
ExitProcess(0);
}
}
}
#endif