MultiThreadBase

Trait MultiThreadBase 

Source
pub trait MultiThreadBase: Target {
    // Required methods
    fn read_registers(
        &mut self,
        regs: &mut <Self::Arch as Arch>::Registers,
        tid: Tid,
    ) -> TargetResult<(), Self>;
    fn write_registers(
        &mut self,
        regs: &<Self::Arch as Arch>::Registers,
        tid: Tid,
    ) -> TargetResult<(), Self>;
    fn read_addrs(
        &mut self,
        start_addr: <Self::Arch as Arch>::Usize,
        data: &mut [u8],
        tid: Tid,
    ) -> TargetResult<usize, Self>;
    fn write_addrs(
        &mut self,
        start_addr: <Self::Arch as Arch>::Usize,
        data: &[u8],
        tid: Tid,
    ) -> TargetResult<(), Self>;
    fn list_active_threads(
        &mut self,
        thread_is_active: &mut dyn FnMut(Tid),
    ) -> Result<(), Self::Error>;

    // Provided methods
    fn support_single_register_access(
        &mut self,
    ) -> Option<SingleRegisterAccessOps<'_, Tid, Self>> { ... }
    fn is_thread_alive(&mut self, tid: Tid) -> Result<bool, Self::Error> { ... }
    fn support_resume(&mut self) -> Option<MultiThreadResumeOps<'_, Self>> { ... }
    fn support_thread_extra_info(
        &mut self,
    ) -> Option<ThreadExtraInfoOps<'_, Self>> { ... }
}
Expand description

Base required debugging operations for multi threaded targets.

Required Methods§

Source

fn read_registers( &mut self, regs: &mut <Self::Arch as Arch>::Registers, tid: Tid, ) -> TargetResult<(), Self>

Read the target’s registers.

If the registers could not be accessed, an appropriate non-fatal error should be returned.

Source

fn write_registers( &mut self, regs: &<Self::Arch as Arch>::Registers, tid: Tid, ) -> TargetResult<(), Self>

Write the target’s registers.

If the registers could not be accessed, an appropriate non-fatal error should be returned.

Source

fn read_addrs( &mut self, start_addr: <Self::Arch as Arch>::Usize, data: &mut [u8], tid: Tid, ) -> TargetResult<usize, Self>

Read bytes from the specified address range and return the number of bytes that were read.

Implementations may return a number n that is less than data.len() to indicate that memory starting at start_addr + n cannot be accessed.

Implemenations may also return an appropriate non-fatal error if the requested address range could not be accessed (e.g: due to MMU protection, unhanded page fault, etc…).

Implementations must guarantee that the returned number is less than or equal data.len().

Source

fn write_addrs( &mut self, start_addr: <Self::Arch as Arch>::Usize, data: &[u8], tid: Tid, ) -> TargetResult<(), Self>

Write bytes to the specified address range.

If the requested address range could not be accessed (e.g: due to MMU protection, unhanded page fault, etc…), an appropriate non-fatal error should be returned.

Source

fn list_active_threads( &mut self, thread_is_active: &mut dyn FnMut(Tid), ) -> Result<(), Self::Error>

List all currently active threads.

See the section above on implementing thread-related methods on bare-metal (threadless) targets.

Note: Implementors should mark this method as #[inline(always)], as this will result in better codegen (namely, by sidestepping any of the dyn FnMut closure machinery).

Provided Methods§

Source

fn support_single_register_access( &mut self, ) -> Option<SingleRegisterAccessOps<'_, Tid, Self>>

Support for single-register access. See SingleRegisterAccess for more details.

While this is an optional feature, it is highly recommended to implement it when possible, as it can significantly improve performance on certain architectures.

Source

fn is_thread_alive(&mut self, tid: Tid) -> Result<bool, Self::Error>

Check if the specified thread is alive.

As a convenience, this method provides a default implementation which uses list_active_threads to do a linear-search through all active threads. On thread-heavy systems, it may be more efficient to override this method with a more direct query.

Source

fn support_resume(&mut self) -> Option<MultiThreadResumeOps<'_, Self>>

Support for resuming the target (e.g: via continue or step)

Source

fn support_thread_extra_info(&mut self) -> Option<ThreadExtraInfoOps<'_, Self>>

Support for providing thread extra information.

Implementors§