authorgravatar for jonathan.haehne@hotmail.comTau <jonathan.haehne@hotmail.com> 2024-06-24 09:30:22+02:00
committergravatar for jonathan.haehne@hotmail.comTau <jonathan.haehne@hotmail.com> 2024-07-19 17:51:38+02:00
log3bfa63aa6151c339e02f36819f23ea547c41eb8f
treeeadbbfcbbb19230b4ddf1e0eb397851b0c79405a
parent9c2d597e69d13326970daadbaf7fd14f7da64c45

ModuleDebugInfo: Discard C++ namespaces appearing in PDBs


2 files changed, 13 insertions(+), 3 deletions(-)

lib/std/debug.zig+12-1
......@@ -2465,13 +2465,24 @@ pub const ModuleDebugInfo = switch (native_os) {
24652465 module,
24662466 relocated_address - coff_section.virtual_address,
24672467 ) orelse "???";
2468 // While DWARF gets us just the function's own name, the PDB
2469 // stores it qualified with its namespace by the C++ `::`
2470 // operator. We can strip that for consistency; the
2471 // SymbolInfo will contain the line number, which is a more
2472 // language-neutral way of distinguishing same-named symbols
2473 // anyway.
2474 const symbol_simple_name = if (mem.indexOf(u8, symbol_name, "::")) |cpp_namespace|
2475 symbol_name[cpp_namespace + 2 ..]
2476 else
2477 symbol_name;
2478
24682479 const opt_line_info = try self.pdb.?.getLineNumberInfo(
24692480 module,
24702481 relocated_address - coff_section.virtual_address,
24712482 );
24722483
24732484 return SymbolInfo{
2474 .symbol_name = symbol_name,
2485 .symbol_name = symbol_simple_name,
24752486 .compile_unit_name = obj_basename,
24762487 .line_info = opt_line_info,
24772488 };
src/codegen/llvm.zig+1-2
......@@ -2457,8 +2457,7 @@ pub const Object = struct {
24572457 // We still may want these for a Zig expression
24582458 // evaluator in debuggers, but for now they are
24592459 // completely useless.
2460 .ComptimeInt, .ComptimeFloat,
2461 .Type, .Undefined, .Null, .EnumLiteral => continue,
2460 .ComptimeInt, .ComptimeFloat, .Type, .Undefined, .Null, .EnumLiteral => continue,
24622461 else => {},
24632462 }
24642463