mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-14 00:11:01 +00:00
write module file paths in the crash reports' JSON files
This commit is contained in:
parent
a49512abde
commit
4e32660946
1 changed files with 10 additions and 2 deletions
|
@ -115,6 +115,9 @@ static void WIN_DumpStackTrace( debug_help_t* debugHelp )
|
||||||
stackFrame.AddrStack.Mode = AddrModeFlat;
|
stackFrame.AddrStack.Mode = AddrModeFlat;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const HANDLE processHandle = GetCurrentProcess();
|
||||||
|
const HANDLE threadHandle = GetCurrentThread();
|
||||||
|
|
||||||
JSONW_BeginNamedArray("stack_trace");
|
JSONW_BeginNamedArray("stack_trace");
|
||||||
|
|
||||||
unsigned char buffer[sizeof(IMAGEHLP_SYMBOL64) + BUFFER_SIZE];
|
unsigned char buffer[sizeof(IMAGEHLP_SYMBOL64) + BUFFER_SIZE];
|
||||||
|
@ -123,7 +126,7 @@ static void WIN_DumpStackTrace( debug_help_t* debugHelp )
|
||||||
int level = 1;
|
int level = 1;
|
||||||
while (level++ < (MAX_LEVELS + 1)) {
|
while (level++ < (MAX_LEVELS + 1)) {
|
||||||
BOOL result = debugHelp->StackWalk64(
|
BOOL result = debugHelp->StackWalk64(
|
||||||
machineType, GetCurrentProcess(), GetCurrentThread(), &stackFrame, &context,
|
machineType, processHandle, threadHandle, &stackFrame, &context,
|
||||||
NULL, debugHelp->SymFunctionTableAccess64, debugHelp->SymGetModuleBase64, NULL);
|
NULL, debugHelp->SymFunctionTableAccess64, debugHelp->SymGetModuleBase64, NULL);
|
||||||
if (!result || stackFrame.AddrPC.Offset == 0)
|
if (!result || stackFrame.AddrPC.Offset == 0)
|
||||||
break;
|
break;
|
||||||
|
@ -139,10 +142,15 @@ static void WIN_DumpStackTrace( debug_help_t* debugHelp )
|
||||||
JSONW_HexValue("return_address", stackFrame.AddrReturn.Offset);
|
JSONW_HexValue("return_address", stackFrame.AddrReturn.Offset);
|
||||||
|
|
||||||
DWORD64 displacement;
|
DWORD64 displacement;
|
||||||
result = debugHelp->SymGetSymFromAddr64(GetCurrentProcess(), stackFrame.AddrPC.Offset, &displacement, symbol);
|
result = debugHelp->SymGetSymFromAddr64(processHandle, stackFrame.AddrPC.Offset, &displacement, symbol);
|
||||||
if (result)
|
if (result)
|
||||||
JSONW_StringValue("name", symbol->Name);
|
JSONW_StringValue("name", symbol->Name);
|
||||||
|
|
||||||
|
const DWORD64 moduleBase = debugHelp->SymGetModuleBase64(processHandle, stackFrame.AddrPC.Offset);
|
||||||
|
char moduleName[MAX_PATH];
|
||||||
|
if (moduleBase && GetModuleFileNameA((HMODULE)moduleBase, moduleName, sizeof(moduleName)))
|
||||||
|
JSONW_StringValue("module_name", moduleName);
|
||||||
|
|
||||||
JSONW_EndObject();
|
JSONW_EndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue