Trait DataResolver

Source
pub trait DataResolver {
    // Provided methods
    fn read_memory(&self, address: u64, size: usize) -> Result<Vec<u8>> { ... }
    fn read_address(&self, address: u64) -> Result<u64> { ... }
    fn get_register(&self, idx: usize) -> Result<u64> { ... }
    fn get_stack_pointer(&self) -> Result<u64> { ... }
    fn allocate_memory(&self, size: usize) -> Result<u64> { ... }
    fn write_memory(&self, address: u64, data: &[u8]) -> Result<()> { ... }
}
Expand description

Trait for resolving data from memory during debugging.

Implementors provide access to the target process’s memory and registers, allowing the debug info library to read variable values and follow pointers.

NOTE: All of the addresses passed to/return from this trait will be relative to the target binary and does not account for ASLR (Address Space Layout Randomization).

Provided Methods§

Source

fn read_memory(&self, address: u64, size: usize) -> Result<Vec<u8>>

Reads raw bytes from memory at the given address.

§Arguments
  • address - The memory address to read from
  • size - Number of bytes to read
§Returns

The bytes read from memory

Source

fn read_address(&self, address: u64) -> Result<u64>

Reads a 64-bit address from memory.

This method handles pointer dereferencing.

§Arguments
  • address - The memory address to read the pointer from
§Returns

The dereferenced address

Source

fn get_register(&self, idx: usize) -> Result<u64>

Gets a specific register value by index.

§Arguments
  • idx - The register index (architecture-specific)
§Returns

The register value

Source

fn get_stack_pointer(&self) -> Result<u64>

Source

fn allocate_memory(&self, size: usize) -> Result<u64>

Allocates memory in the target process.

§Arguments
  • size - Number of bytes to allocate
§Returns

The address of the allocated memory

Source

fn write_memory(&self, address: u64, data: &[u8]) -> Result<()>

Writes data to memory in the target process.

§Arguments
  • address - The memory address to write to
  • data - The bytes to write

Implementors§