port: display module offsets in the windows crashlog

This commit is contained in:
fgsfds committed 2024-01-07 16:43:20 +01:00
1 parent d1d288b96a
commit ba52580e0c
1 file changed
+6 -2
+6 -2
View File
@@ -79,8 +79,8 @@ static void crashStackTrace(char *msg, PEXCEPTION_POINTERS exinfo)
if (SymGetLineFromAddr64(process, (uintptr_t)exinfo->ExceptionRecord->ExceptionAddress, &disp, &line)) {
CRASH_MSG(": %s:%lu+%lu", line.FileName, line.LineNumber, disp);
}
CRASH_MSG("\nMODULE: %p\n", crashGetModuleBase(exinfo->ExceptionRecord->ExceptionAddress));
CRASH_MSG("MAIN MODULE: %p\n", crashGetModuleBase(crashInit));
CRASH_MSG("\nMODULE: [%p]\n", crashGetModuleBase(exinfo->ExceptionRecord->ExceptionAddress));
CRASH_MSG("MAIN MODULE: [%p]\n", crashGetModuleBase(crashInit));
CRASH_MSG("\nBACKTRACE:\n");
char symbuf[sizeof(SYMBOL_INFO) + CRASH_MAX_SYM * sizeof(TCHAR)];
@@ -99,6 +99,10 @@ static void crashStackTrace(char *msg, PEXCEPTION_POINTERS exinfo)
if (SymFromAddr(process, stackframe.AddrPC.Offset, &disp64, sym)) {
CRASH_MSG(": %s+%llu", sym->Name, disp64);
} else if (process, stackframe.AddrPC.Offset) {
const uintptr_t modbase = (uintptr_t)crashGetModuleBase((void *)(uintptr_t)stackframe.AddrPC.Offset);
const uintptr_t modofs = (uintptr_t)stackframe.AddrPC.Offset - modbase;
CRASH_MSG(": [%p]+%p", (void *)modbase, (void *)modofs);
}
if(SymGetLineFromAddr64(process, stackframe.AddrPC.Offset, &disp, &line)) {