DoxigAlpha

Function parameters

Parameters

#
ranges_value:*const FormValue
di:*const Dwarf
compile_unit:*const CompileUnit

Type definitions in this namespace

Types

#
ExceptionFrameHeader
This represents the decoded .eh_frame_hdr header

Initialize DWARF info.

Functions

#
open
Initialize DWARF info.
findCompileUnit
TODO: change this to binary searching the sorted compile unit list
scanAllUnwindInfo
If `.eh_frame_hdr` is present, then only the header needs to be parsed.
scanCieFdeInfo
Scan `.eh_frame` and `.debug_frame` and build a sorted list of FDEs for binary searching during
compactUnwindToDwarfRegNumber
Returns the DWARF register number for an x86_64 register number found in compact unwind info
bad
This function is to make it handy to comment out the return and make it

Error sets in this namespace

Error Sets

#

= [_]?Section{null} ** num_sections

Values

#
null_section_array
= [_]?Section{null} ** num_sections

Source

Implementation

#
pub fn init(ranges_value: *const FormValue, di: *const Dwarf, compile_unit: *const CompileUnit) !@This() {
    const section_type = if (compile_unit.version >= 5) Section.Id.debug_rnglists else Section.Id.debug_ranges;
    const debug_ranges = di.section(section_type) orelse return error.MissingDebugInfo;

    const ranges_offset = switch (ranges_value.*) {
        .sec_offset, .udata => |off| off,
        .rnglistx => |idx| off: {
            switch (compile_unit.format) {
                .@"32" => {
                    const offset_loc = @as(usize, @intCast(compile_unit.rnglists_base + 4 * idx));
                    if (offset_loc + 4 > debug_ranges.len) return bad();
                    const offset = mem.readInt(u32, debug_ranges[offset_loc..][0..4], di.endian);
                    break :off compile_unit.rnglists_base + offset;
                },
                .@"64" => {
                    const offset_loc = @as(usize, @intCast(compile_unit.rnglists_base + 8 * idx));
                    if (offset_loc + 8 > debug_ranges.len) return bad();
                    const offset = mem.readInt(u64, debug_ranges[offset_loc..][0..8], di.endian);
                    break :off compile_unit.rnglists_base + offset;
                },
            }
        },
        else => return bad(),
    };

    // All the addresses in the list are relative to the value
    // specified by DW_AT.low_pc or to some other value encoded
    // in the list itself.
    // If no starting value is specified use zero.
    const base_address = compile_unit.die.getAttrAddr(di, AT.low_pc, compile_unit.*) catch |err| switch (err) {
        error.MissingDebugInfo => 0,
        else => return err,
    };

    return .{
        .base_address = base_address,
        .section_type = section_type,
        .di = di,
        .compile_unit = compile_unit,
        .fbr = .{
            .buf = debug_ranges,
            .pos = cast(usize, ranges_offset) orelse return bad(),
            .endian = di.endian,
        },
    };
}