Function populateRanges [src]

Prototype

pub fn populateRanges(d: *Dwarf, gpa: Allocator) ScanError!void

Parameters

d: *Dwarfgpa: Allocator

Possible Errors

EndOfBuffer Error
InvalidBuffer Error
InvalidDebugInfo
MissingDebugInfo
OutOfMemory Error
Overflow Error

Source

pub fn populateRanges(d: *Dwarf, gpa: Allocator) ScanError!void { assert(d.ranges.items.len == 0); for (d.compile_unit_list.items, 0..) |*cu, cu_index| { if (cu.pc_range) |range| { try d.ranges.append(gpa, .{ .start = range.start, .end = range.end, .compile_unit_index = cu_index, }); continue; } const ranges_value = cu.die.getAttr(AT.ranges) orelse continue; var iter = DebugRangeIterator.init(ranges_value, d, cu) catch continue; while (try iter.next()) |range| { // Not sure why LLVM thinks it's OK to emit these... if (range.start == range.end) continue; try d.ranges.append(gpa, .{ .start = range.start, .end = range.end, .compile_unit_index = cu_index, }); } } std.mem.sortUnstable(Range, d.ranges.items, {}, struct { pub fn lessThan(ctx: void, a: Range, b: Range) bool { _ = ctx; return a.start < b.start; } }.lessThan); }