[*] Force NT exception handles to create the directory tree if not present.
[*] Fix panic on mayday
This commit is contained in:
parent
5bc1985eca
commit
b1c4e26f91
@ -152,14 +152,14 @@ namespace Aurora::Debug
|
||||
if (!fatal)
|
||||
{
|
||||
if (IsDebuggerPresent()) __debugbreak();
|
||||
else BlackboxReport(pExceptionInfo);
|
||||
else BlackboxReport(pExceptionInfo, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveMinidump(pExceptionInfo);
|
||||
}
|
||||
#else
|
||||
BlackboxReport(pExceptionInfo);
|
||||
BlackboxReport(pExceptionInfo, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -246,11 +246,13 @@ namespace Aurora::Debug
|
||||
MiniDumpWithThreadInfo;
|
||||
|
||||
std::wstring path;
|
||||
AuString utf8Path;
|
||||
while (path.empty())
|
||||
{
|
||||
try
|
||||
{
|
||||
path = Locale::ConvertFromUTF8(AuIOFS::NormalizePathRet("./Logs/Crashes/" + GetDumpName()));
|
||||
utf8Path = AuIOFS::NormalizePathRet("./Logs/Crashes/" + GetDumpName());
|
||||
path = Locale::ConvertFromUTF8(utf8Path);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -258,6 +260,8 @@ namespace Aurora::Debug
|
||||
}
|
||||
}
|
||||
|
||||
AuIOFS::CreateDirectories(utf8Path, true);
|
||||
|
||||
auto hFile = CreateFileW(path.c_str(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
@ -290,11 +294,12 @@ namespace Aurora::Debug
|
||||
}
|
||||
#endif
|
||||
|
||||
void BlackboxReport(_EXCEPTION_POINTERS *ExceptionInfo)
|
||||
void BlackboxReport(_EXCEPTION_POINTERS *ExceptionInfo, bool fatal)
|
||||
{
|
||||
AuString path;
|
||||
HANDLE hFile;
|
||||
std::wstring wpath;
|
||||
AuString utf8Path;
|
||||
MINIDUMP_EXCEPTION_INFORMATION info;
|
||||
|
||||
auto ok = AuIOFS::GetProfileDomain(path);
|
||||
@ -319,7 +324,8 @@ namespace Aurora::Debug
|
||||
{
|
||||
try
|
||||
{
|
||||
wpath = Locale::ConvertFromUTF8(path + "Crashes/" + GetDumpName());
|
||||
utf8Path = path + "Crashes/" + GetDumpName();
|
||||
wpath = Locale::ConvertFromUTF8(utf8Path);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -327,6 +333,8 @@ namespace Aurora::Debug
|
||||
}
|
||||
}
|
||||
|
||||
AuIOFS::CreateDirectories(utf8Path, true);
|
||||
|
||||
hFile = CreateFileW(wpath.c_str(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
@ -350,7 +358,10 @@ namespace Aurora::Debug
|
||||
report.resource.type = Telemetry::ENewBlackBoxResourceType::eLocal;
|
||||
Telemetry::ReportDyingBreath(report);
|
||||
|
||||
__fastfail('fokd');
|
||||
if (fatal)
|
||||
{
|
||||
__fastfail('fokd');
|
||||
}
|
||||
}
|
||||
|
||||
void InitWin32()
|
||||
|
@ -14,5 +14,5 @@ namespace Aurora::Debug
|
||||
#if defined(DEBUG) || defined(INTERNAL)
|
||||
void SaveMinidump(_EXCEPTION_POINTERS *ExceptionInfo);
|
||||
#endif
|
||||
void BlackboxReport(_EXCEPTION_POINTERS *ExceptionInfo);
|
||||
void BlackboxReport(_EXCEPTION_POINTERS *ExceptionInfo, bool isFatal);
|
||||
}
|
Loading…
Reference in New Issue
Block a user