Skip to main content

ReadMemory

Trait ReadMemory 

Source
pub trait ReadMemory {
    type Error: Error;

    // Required methods
    fn at_decode_begin(&mut self) -> Result<(), Self::Error>;
    fn read_memory<T>(
        &mut self,
        address: u64,
        size: usize,
        callback: impl FnOnce(&[u8]) -> T,
    ) -> Result<T, Self::Error>;
}
Expand description

Memory reader

Required Associated Types§

Source

type Error: Error

Error for memory reading

Required Methods§

Source

fn at_decode_begin(&mut self) -> Result<(), Self::Error>

Callback at begin of decoding.

This is useful when using the same handler to process multiple Intel PT traces

Source

fn read_memory<T>( &mut self, address: u64, size: usize, callback: impl FnOnce(&[u8]) -> T, ) -> Result<T, Self::Error>

Read memories at given address with given size, and invoke the given callback with the read memories.

This function is allowed to read memories shorter than size. The length of read bytes should be determined from users by check the length of &[u8] at callback.

This function will return the callback return value on success.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ReadMemory for LibxdcMemoryReader

Available on crate feature libxdc_memory_reader only.
Source§

impl ReadMemory for PerfMmapBasedMemoryReader

Available on crate feature perf_memory_reader only.