authorgravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-04-07 13:51:35-07:00
committergravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-04-12 04:01:29-07:00
loga1a8dd1b40d2f42e9df6fee053c2cb737e0753f7
tree86980c2168b5d383ad81c4a3cb7471d5335aeda6
parent781bab193b3ea026d2bd6adf8150bb6510205766

Filters out duplicate sites, outputs compile unit name


1 files changed, 10 insertions(+), 1 deletions(-)

lib/std/debug/SelfInfo/Windows.zig+10-1
...@@ -68,9 +68,18 @@ pub const SymbolIterator = struct {...@@ -68,9 +68,18 @@ pub const SymbolIterator = struct {
68 if (pdb.getInlineeInfo(info.module, site.inlinee) catch null) |loc| {68 if (pdb.getInlineeInfo(info.module, site.inlinee) catch null) |loc| {
69 const offset_in_func = info.addr - proc.code_offset;69 const offset_in_func = info.addr - proc.code_offset;
70 if (try pdb.calculateOffset(site, loc, offset_in_func)) |offset| {70 if (try pdb.calculateOffset(site, loc, offset_in_func)) |offset| {
71 // If we've found a match, filter out any duplicate sites that
72 // follow. Tools like llvm-addr2line output duplicate sites in the
73 // same cases as us, implying that they exist in the underlying
74 // data and are not indicative of a parser bug.
75 while (info.inline_sites.getLastOrNull()) |top| {
76 if (top.inlinee != site.inlinee) break;
77 _ = info.inline_sites.pop();
78 }
79
71 return .{80 return .{
72 .name = pdb.findInlineeName(site.inlinee),81 .name = pdb.findInlineeName(site.inlinee),
73 .compile_unit_name = null,82 .compile_unit_name = fs.path.basename(info.module.obj_file_name),
74 .source_location = offset,83 .source_location = offset,
75 };84 };
76 }85 }