aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorTau <jonathan.haehne@hotmail.com>2024-06-24 09:30:22 +0200
committerTau <jonathan.haehne@hotmail.com>2024-07-19 17:51:38 +0200
commit3bfa63aa6151c339e02f36819f23ea547c41eb8f (patch)
treeeadbbfcbbb19230b4ddf1e0eb397851b0c79405a /lib/std/debug.zig
parent9c2d597e69d13326970daadbaf7fd14f7da64c45 (diff)
downloadzig-3bfa63aa6151c339e02f36819f23ea547c41eb8f.tar.gz
zig-3bfa63aa6151c339e02f36819f23ea547c41eb8f.zip
ModuleDebugInfo: Discard C++ namespaces appearing in PDBs
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index 568b49f2f6..febc0b2609 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -2465,13 +2465,24 @@ pub const ModuleDebugInfo = switch (native_os) {
module,
relocated_address - coff_section.virtual_address,
) orelse "???";
+ // While DWARF gets us just the function's own name, the PDB
+ // stores it qualified with its namespace by the C++ `::`
+ // operator. We can strip that for consistency; the
+ // SymbolInfo will contain the line number, which is a more
+ // language-neutral way of distinguishing same-named symbols
+ // anyway.
+ const symbol_simple_name = if (mem.indexOf(u8, symbol_name, "::")) |cpp_namespace|
+ symbol_name[cpp_namespace + 2 ..]
+ else
+ symbol_name;
+
const opt_line_info = try self.pdb.?.getLineNumberInfo(
module,
relocated_address - coff_section.virtual_address,
);
return SymbolInfo{
- .symbol_name = symbol_name,
+ .symbol_name = symbol_simple_name,
.compile_unit_name = obj_basename,
.line_info = opt_line_info,
};