debug::image
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
type image = struct {
fd: io::file,
data: []u8,
header: *elf::header64,
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(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) const str;
fn section_reader(image: *image, sec: *elf::section64) memio::stream;
fn self() (image | io::error | fs::error);
Types
type image
Show undocumented member
type image = struct {
fd: io::file,
data: []u8,
header: *elf::header64,
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
fn close(image: *image) void;
Closes a program image.
fn open
fn open(file: io::file) (image | io::error);
Opens an io::file as a program image.
fn section_byname
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
fn section_data(image: *image, sec: *elf::section64) []u8;
Returns a slice of the data contained with a given section.
fn section_name
fn section_name(image: *image, sec: *elf::section64) const 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
fn section_reader(image: *image, sec: *elf::section64) memio::stream;
Returns a memio::fixed reader for the given section.
fn self
fn self() (image | io::error | fs::error);
Opens the executing process's binary image.