Files
source/tools/CMakeLists.txt
T
3794e3a274 Symbolize crash reports with a first-party tool
Adds tools/symbolize_crash.cpp, built alongside the game as a console exe:
it reads a crash_report_*.txt written by writeExceptionBacktrace and prints
the backtrace with function names, source lines and inlined frames, in call
order, coloured when standard output is a console.

Symbols come from DbgHelp against the build's PDB rather than an external
symbolizer. SymLoadModuleEx takes the runtime base out of the report's
module table, so the relocation arithmetic /DYNAMICBASE forces on us is
DbgHelp's problem now; a report predating the module table loads at the
image's preferred base, which is where it ran. Verified under Wine: PDB
line info and inline traces both resolve.

The tool wants C++23 (std::print, std::format) where the game is C++17, so
the standard is set on the target alone. Both MSVC 19.51 and clang-cl build
it clean in all three configurations.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 10:25:47 -03:00

13 lines
599 B
CMake

# Developer tools. Console programs, no game code and no Application preprocessor
# definitions, so each is built once no matter which applications are configured.
# Reads a crash report written by sgp::writeExceptionBacktrace and resolves its
# addresses against a build's PDB. Wants C++23 (std::print, std::format); the game
# itself is C++17, hence the per-target standard.
add_executable(symbolize_crash symbolize_crash.cpp)
target_link_libraries(symbolize_crash PRIVATE "dbghelp.lib")
set_target_properties(symbolize_crash PROPERTIES
CXX_STANDARD 23
CXX_STANDARD_REQUIRED ON
)