pub fn getInlineeSourceLines(self: *Pdb, mod: *Module, inlinee: u32) InlineeSourceLocationIterator 718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751pub fn getInlineeSourceLines(self: *Pdb, mod: *Module, inlinee: u32) InlineeSourceLocationIterator {
_ = self;
// Binary search to an arbitrary match, if there are other matches they will be adjacent
const any = std.sort.binarySearch(
*align(1) const pdb.InlineeSourceLine,
mod.inlinee_source_lines,
inlinee,
compareInlineeSourceLineInlinee,
) orelse return .empty;
// Linearly scan to the first match
const begin = b: {
var begin = any;
while (begin > 0) {
const prev = begin - 1;
if (mod.inlinee_source_lines[prev].inlinee != inlinee) break;
begin = prev;
}
break :b begin;
};
// Linearly scan to the last match
const end = b: {
var end = any + 1;
while (end < mod.inlinee_source_lines.len and
mod.inlinee_source_lines[end].inlinee == inlinee) : (end += 1)
{}
break :b end;
};
// Return an iterator over all matches (the iterator filters out duplicate entries)
return .{ .lines = mod.inlinee_source_lines[begin..end] };
}
Returns all
pdb.InlineeSourceLines for a given module with the given inlinee. Ideally there would only be one entry per inlinee, but LLVM appears to assign all functions that share a name the same inlinee ID. This is a bug: https://github.com/llvm/llvm-project/issues/191787 The best the caller can do right now is print all the results.