diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-07-21 00:19:52 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-21 00:19:52 -0700 |
| commit | 397be0c9cc8156d38d1487a4c80210007033cbd0 (patch) | |
| tree | d34820b5591b79d7f9cd71f2b671fdbfc7c9e3dc /lib/std/debug.zig | |
| parent | 18d412ab2fb7bda92f7bfbdf732849bbcd066c33 (diff) | |
| parent | 94cf4d2d8193efb0ae642d475fb8437eb4c7e8c1 (diff) | |
| download | zig-397be0c9cc8156d38d1487a4c80210007033cbd0.tar.gz zig-397be0c9cc8156d38d1487a4c80210007033cbd0.zip | |
Merge pull request #20380 from tau-dev/master
llvm: Nest debug info correctly
Diffstat (limited to 'lib/std/debug.zig')
| -rw-r--r-- | lib/std/debug.zig | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig index bc7023eae2..6780e17e1e 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -2459,13 +2459,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, }; |
