debug::image+x86_64 +linux
image: executable file format introspection
This module implements functionality for examining executable files. It provides some support code for working with memory-mapped ELF executables.
This module does not make compatibility guarantees and is subject to change in the future should Hare be ported to a target with a different executable format.
Index
Types
// Undocumented types: type image;
Functions
fn close(image: *image) void; fn open(file: io::file) (image | io::error); fn section_byname(image: *image, name: str) nullable *elf::section64; fn section_data(image: *image, sec: *elf::section64) []u8; fn section_name(image: *image, sec: *elf::section64) str; fn section_reader(image: *image, sec: *elf::section64) memio::stream; fn self() (image | io::error | fs::error);
Types
type image[permalink] [source]
Show undocumented member
type image = struct { fd: io::file, data: []u8, header: *elf::header64, // Cached sections shstrtab: nullable *elf::section64, symtab: nullable *elf::section64, strtab: nullable *elf::section64, debug_abbr: nullable *elf::section64, debug_aranges: nullable *elf::section64, debug_info: nullable *elf::section64, debug_line: nullable *elf::section64, debug_str: nullable *elf::section64, };
Functions
fn close[permalink] [source]
fn close(image: *image) void;
Closes a program image.
fn open[permalink] [source]
fn open(file: io::file) (image | io::error);
Opens an io::file as a program image.
fn section_byname[permalink] [source]
fn section_byname(image: *image, name: str) nullable *elf::section64;
Returns a program section by name. Returns null if there is no such section, or if the section names are not available in this image (e.g. because it was stripped).
fn section_data[permalink] [source]
fn section_data(image: *image, sec: *elf::section64) []u8;
Returns a slice of the data contained with a given section.
fn section_name[permalink] [source]
fn section_name(image: *image, sec: *elf::section64) str;
Returns the name of this elf::section64, returning "" if the section names are not available in this image (i.e. it has been stripped).
fn section_reader[permalink] [source]
fn section_reader(image: *image, sec: *elf::section64) memio::stream;
Returns a memio::fixed reader for the given section.
fn self[permalink] [source]
fn self() (image | io::error | fs::error);
Opens the executing process's binary image.