Skip to content

Commit

Permalink
ModuleDebugInfo: Discard C++ namespaces appearing in PDBs
Browse files Browse the repository at this point in the history
  • Loading branch information
tau-dev committed Jun 27, 2024
1 parent 076b611 commit ab7006f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 12 additions & 1 deletion lib/std/debug.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2393,13 +2393,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,
};
Expand Down
3 changes: 1 addition & 2 deletions src/codegen/llvm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2532,8 +2532,7 @@ pub const Object = struct {
// We still may want these for a Zig expression
// evaluator in debuggers, but for now they are
// completely useless.
.ComptimeInt, .ComptimeFloat,
.Type, .Undefined, .Null, .EnumLiteral => continue,
.ComptimeInt, .ComptimeFloat, .Type, .Undefined, .Null, .EnumLiteral => continue,
else => {},
}

Expand Down

0 comments on commit ab7006f

Please sign in to comment.