Merge pull request #100207 from bruvzg/mingw_dbg

[Windows] Fix MinGW debug symbols.
This commit is contained in:
Thaddeus Crews
2024-12-10 14:16:06 -06:00
2 changed files with 9 additions and 3 deletions

View File

@@ -731,6 +731,9 @@ if env.msvc:
env.Append(CCFLAGS=["/Od"])
else:
if env["debug_symbols"]:
if env["platform"] == "windows":
env.Append(CCFLAGS=["-gdwarf-5"])
else:
# Adding dwarf-4 explicitly makes stacktraces work with clang builds,
# otherwise addr2line doesn't understand them
env.Append(CCFLAGS=["-gdwarf-4"])

View File

@@ -164,6 +164,9 @@ extern void CrashHandlerException(int signal) {
int64_t image_file_base = get_image_base(_execpath);
data.offset = image_mem_base - image_file_base;
if (FileAccess::exists(_execpath + ".debugsymbols")) {
_execpath = _execpath + ".debugsymbols";
}
data.state = backtrace_create_state(_execpath.utf8().get_data(), 0, &error_callback, reinterpret_cast<void *>(&data));
if (data.state != nullptr) {
data.index = 1;