Function readElfDebugInfo [src]
Reads debug info from an ELF file, or the current binary if none in specified.
If the required sections aren't present but a reference to external debug info is,
then this this function will recurse to attempt to load the debug sections from
an external file.
Prototype
pub fn readElfDebugInfo( allocator: Allocator, elf_filename: ?[]const u8, build_id: ?[]const u8, expected_crc: ?u32, parent_sections: *Dwarf.SectionArray, parent_mapped_mem: ?[]align(std.heap.page_size_min) const u8, ) !Dwarf.ElfModule
Parameters
allocator: Allocator
elf_filename: ?[]const u8
build_id: ?[]const u8
expected_crc: ?u32
parent_sections: *Dwarf.SectionArray
parent_mapped_mem: ?[]align(std.heap.page_size_min) const u8
Source
pub fn readElfDebugInfo(
allocator: Allocator,
elf_filename: ?[]const u8,
build_id: ?[]const u8,
expected_crc: ?u32,
parent_sections: *Dwarf.SectionArray,
parent_mapped_mem: ?[]align(std.heap.page_size_min) const u8,
) !Dwarf.ElfModule {
nosuspend {
const elf_file = (if (elf_filename) |filename| blk: {
break :blk fs.cwd().openFile(filename, .{});
} else fs.openSelfExe(.{})) catch |err| switch (err) {
error.FileNotFound => return error.MissingDebugInfo,
else => return err,
};
const mapped_mem = try mapWholeFile(elf_file);
return Dwarf.ElfModule.load(
allocator,
mapped_mem,
build_id,
expected_crc,
parent_sections,
parent_mapped_mem,
elf_filename,
);
}
}