DoxigAlpha

loadPath

Function parameters

Parameters

#
build_id:?[]const u8
expected_crc:?u32
parent_sections:*Dwarf.SectionArray
parent_mapped_mem:?[]align(std.heap.page_size_min) const u8

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 loadPath(
    gpa: Allocator,
    elf_file_path: Path,
    build_id: ?[]const u8,
    expected_crc: ?u32,
    parent_sections: *Dwarf.SectionArray,
    parent_mapped_mem: ?[]align(std.heap.page_size_min) const u8,
) LoadError!Dwarf.ElfModule {
    const elf_file = elf_file_path.root_dir.handle.openFile(elf_file_path.sub_path, .{}) catch |err| switch (err) {
        error.FileNotFound => return missing(),
        else => return err,
    };
    defer elf_file.close();

    const end_pos = elf_file.getEndPos() catch return bad();
    const file_len = cast(usize, end_pos) orelse return error.Overflow;

    const mapped_mem = std.posix.mmap(
        null,
        file_len,
        std.posix.PROT.READ,
        .{ .TYPE = .SHARED },
        elf_file.handle,
        0,
    ) catch |err| switch (err) {
        error.MappingAlreadyExists => unreachable,
        else => |e| return e,
    };
    errdefer std.posix.munmap(mapped_mem);

    return load(
        gpa,
        mapped_mem,
        build_id,
        expected_crc,
        parent_sections,
        parent_mapped_mem,
        elf_file_path.sub_path,
    );
}