Function findCompileUnit [src]
TODO: change this to binary searching the sorted compile unit list
Prototype
pub fn findCompileUnit(di: *const Dwarf, target_address: u64) !*CompileUnit
Parameters
di: *const Dwarf
target_address: u64
Source
pub fn findCompileUnit(di: *const Dwarf, target_address: u64) !*CompileUnit {
for (di.compile_unit_list.items) |*compile_unit| {
if (compile_unit.pc_range) |range| {
if (target_address >= range.start and target_address < range.end) return compile_unit;
}
const ranges_value = compile_unit.die.getAttr(AT.ranges) orelse continue;
var iter = DebugRangeIterator.init(ranges_value, di, compile_unit) catch continue;
while (try iter.next()) |range| {
if (target_address >= range.start and target_address < range.end) return compile_unit;
}
}
return missing();
}