Crashlog: Windows: Handle negative address offsets from BFD symbol
This commit is contained in:
@@ -544,9 +544,13 @@ char *CrashLogWindows::AppendDecodedStacktrace(char *buffer, const char *last) c
|
|||||||
free(demangled);
|
free(demangled);
|
||||||
#endif
|
#endif
|
||||||
if (symbol_ok && bfd_info.function_addr) {
|
if (symbol_ok && bfd_info.function_addr) {
|
||||||
|
if (bfd_info.function_addr < frame.AddrPC.Offset) {
|
||||||
|
buffer += seprintf(buffer, last, " - " OTTD_PRINTF64U, static_cast<DWORD64>(bfd_info.function_addr) - frame.AddrPC.Offset);
|
||||||
|
} else {
|
||||||
buffer += seprintf(buffer, last, " + " OTTD_PRINTF64U, frame.AddrPC.Offset - static_cast<DWORD64>(bfd_info.function_addr));
|
buffer += seprintf(buffer, last, " + " OTTD_PRINTF64U, frame.AddrPC.Offset - static_cast<DWORD64>(bfd_info.function_addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (bfd_info.file_name != nullptr) {
|
if (bfd_info.file_name != nullptr) {
|
||||||
buffer += seprintf(buffer, last, " (%s:%d)", bfd_info.file_name, bfd_info.line);
|
buffer += seprintf(buffer, last, " (%s:%d)", bfd_info.file_name, bfd_info.line);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user