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) {...@@ -2465,13 +2465,24 @@ pub const ModuleDebugInfo = switch (native_os) {
2465 module,2465 module,
2466 relocated_address - coff_section.virtual_address,2466 relocated_address - coff_section.virtual_address,
2467 ) orelse "???";2467 ) 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
2468 const opt_line_info = try self.pdb.?.getLineNumberInfo(2479 const opt_line_info = try self.pdb.?.getLineNumberInfo(
2469 module,2480 module,
2470 relocated_address - coff_section.virtual_address,2481 relocated_address - coff_section.virtual_address,
2471 );2482 );
24722483
2473 return SymbolInfo{2484 return SymbolInfo{
2474 .symbol_name = symbol_name,2485 .symbol_name = symbol_simple_name,
2475 .compile_unit_name = obj_basename,2486 .compile_unit_name = obj_basename,
2476 .line_info = opt_line_info,2487 .line_info = opt_line_info,
2477 };2488 };
src/codegen/llvm.zig+1-2
...@@ -2457,8 +2457,7 @@ pub const Object = struct {...@@ -2457,8 +2457,7 @@ pub const Object = struct {
2457 // We still may want these for a Zig expression2457 // We still may want these for a Zig expression
2458 // evaluator in debuggers, but for now they are2458 // evaluator in debuggers, but for now they are
2459 // completely useless.2459 // completely useless.
2460 .ComptimeInt, .ComptimeFloat,2460 .ComptimeInt, .ComptimeFloat, .Type, .Undefined, .Null, .EnumLiteral => continue,
2461 .Type, .Undefined, .Null, .EnumLiteral => continue,
2462 else => {},2461 else => {},
2463 }2462 }
24642463