Skip to content

Commit

Permalink
fix: fix strange output in Windows crash reports
Browse files Browse the repository at this point in the history
  • Loading branch information
mlugg committed Jun 28, 2021
1 parent be51167 commit 6e6a6e0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/CrashHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,16 @@ static void handler(int signal, siginfo_t *info, void *ucontext)
symbol->SizeOfStruct = sizeof (SYMBOL_INFO);
symbol->MaxNameLen = MAX_SYM_NAME;
const char *symname;
char modulefile[MAX_PATH + 1];
modulefile[0] = 0;
if (SymFromAddr(process, (ULONG64)addr, &displacement, symbol)) {
symname = symbol->NameLen ? symbol->Name : "";
displacement = (uint32_t)addr - (uint32_t)symbol->ModBase;
GetModuleFileNameA((HMODULE)symbol->ModBase, modulefile, MAX_PATH);
} else {
symname = "";
displacement = (uint32_t)addr - (uint32_t)symbol->ModBase;
}

char modulefile[MAX_PATH + 1];
GetModuleFileNameA((HMODULE)symbol->ModBase, modulefile, MAX_PATH);

fprintf(f, "\t%s(%s+0x%x) [0x%08x]\n", modulefile, symname, (uint32_t)displacement, (uint32_t)addr);
}
Expand Down

0 comments on commit 6e6a6e0

Please sign in to comment.