std.dwarf: fix findCompileUnit when ranges offset is given by const

This commit is contained in:
mlugg 2023-06-12 22:17:41 +01:00 committed by Andrew Kelley
parent 1ec14988e1
commit 52e7934a21

View File

@ -936,6 +936,7 @@ pub const DwarfInfo = struct {
const ranges_val = compile_unit.die.getAttr(AT.ranges) orelse continue;
const ranges_offset = switch (ranges_val.*) {
.SecOffset => |off| off,
.Const => |c| try c.asUnsignedLe(),
.RangeListOffset => |idx| off: {
if (compile_unit.is_64) {
const offset_loc = @intCast(usize, compile_unit.rnglists_base + 8 * idx);