pub struct Info { /* private fields */ }Expand description
Process metadata and parsed ELF image used by the tracer.
Info holds the auxiliary vector, an in-memory copy of the ELF file
contents, parsed headers/sections, and the offsets needed to translate
runtime addresses to file offsets. Construct using Info::build.
Implementations§
Source§impl Info
impl Info
Sourcepub fn endianness(&self) -> u8
pub fn endianness(&self) -> u8
Return the ELF data encoding (endianness) byte (EI_DATA).
This value matches the ELF header e_ident[EI_DATA] and can be
compared against ELFDATA2LSB/ELFDATA2MSB constants.
§Returns
The ELF e_ident[EI_DATA] byte as a u8.
Sourcepub fn offset(&self) -> u64
pub fn offset(&self) -> u64
Return the offset used to translate file addresses to runtime
addresses (i.e., mem_offset - load_vaddr).
§Returns
The computed offset which should be added to file addresses to
obtain runtime addresses (equal to mem_offset - load_vaddr).
Sourcepub fn is_addr_in_section(&self, addr: u64, name: &str) -> bool
pub fn is_addr_in_section(&self, addr: u64, name: &str) -> bool
Return true if addr lies within the named ELF section (e.g.
“.text”). Addresses are compared against the section’s runtime
address (section.sh_addr + mem_offset).
§Arguments
addr- Runtime address to test.name- The section name to check (for example".text").
§Returns
true if addr falls within the runtime range of the named section
(computed as section.sh_addr + mem_offset .. + sh_size), otherwise
false.
Sourcepub fn get_section_data(&self, name: &str) -> Result<Option<&[u8]>>
pub fn get_section_data(&self, name: &str) -> Result<Option<&[u8]>>
Retrieves the data from the specified section.
§Arguments
name- The name of the section.
§Errors
Returns an Err if the conversion from u64 to usize fails when getting buffer data.
§Returns
Returns an Ok containing the data from the specified section as a slice of bytes, or Err if the section does not exist or if the conversion from u64 to usize fails.
Sourcepub fn get_opcode_from_addr(&self, addr: u64) -> Result<Option<&[u8]>>
pub fn get_opcode_from_addr(&self, addr: u64) -> Result<Option<&[u8]>>
Retrieves opcode data from the loaded binary at a given runtime address.
§Arguments
addr- The runtime address for which to fetch opcode bytes.
§Errors
Returns an Err if the conversion from u64 to usize fails when accessing the buffer, or if required auxiliary vector data is missing.
§Returns
Returns Ok(Some(&[u8])) containing the opcode bytes at the given address, Ok(None) if the address is invalid, or Err on conversion failure or missing data.