Trait minidump::CpuContext

source ·
pub trait CpuContext {
    type Register: LowerHex;

    const REGISTERS: &'static [&'static str];

    // Required methods
    fn get_register_always(&self, reg: &str) -> Self::Register;
    fn set_register(&mut self, reg: &str, val: Self::Register) -> Option<()>;
    fn stack_pointer_register_name(&self) -> &'static str;
    fn instruction_pointer_register_name(&self) -> &'static str;

    // Provided methods
    fn register_is_valid(
        &self,
        reg: &str,
        valid: &MinidumpContextValidity
    ) -> bool { ... }
    fn get_register(
        &self,
        reg: &str,
        valid: &MinidumpContextValidity
    ) -> Option<Self::Register> { ... }
    fn memoize_register(&self, reg: &str) -> Option<&'static str> { ... }
    fn format_register(&self, reg: &str) -> String { ... }
    fn registers(&self) -> CpuRegisters<'_, Self>  { ... }
    fn valid_registers<'a>(
        &'a self,
        valid: &'a MinidumpContextValidity
    ) -> CpuRegisters<'a, Self>  { ... }
}
Expand description

Generic over the specifics of a CPU context.

Required Associated Types§

source

type Register: LowerHex

The word size of general-purpose registers in the context.

Required Associated Constants§

source

const REGISTERS: &'static [&'static str]

General purpose registers in this context type.

Required Methods§

source

fn get_register_always(&self, reg: &str) -> Self::Register

Get a register value regardless of whether it is valid.

source

fn set_register(&mut self, reg: &str, val: Self::Register) -> Option<()>

Set a register value, if that register name it exists.

Returns None if the register name isn’t supported.

source

fn stack_pointer_register_name(&self) -> &'static str

Gets the name of the stack pointer register (for use with get_register/set_register).

source

fn instruction_pointer_register_name(&self) -> &'static str

Gets the name of the instruction pointer register (for use with get_register/set_register).

Provided Methods§

source

fn register_is_valid(&self, reg: &str, valid: &MinidumpContextValidity) -> bool

Gets whether the given register is valid

This is exposed so that the context can map aliases. For instance “lr” and “x30” are aliases in ARM64.

source

fn get_register( &self, reg: &str, valid: &MinidumpContextValidity ) -> Option<Self::Register>

Get a register value if it is valid.

Get the value of the register named reg from this CPU context if valid indicates that it has a valid value, otherwise return None.

source

fn memoize_register(&self, reg: &str) -> Option<&'static str>

Gets a static version of the given register name, if possible.

Returns the default name of the register for register name aliases.

source

fn format_register(&self, reg: &str) -> String

Return a String containing the value of reg formatted to its natural width.

source

fn registers(&self) -> CpuRegisters<'_, Self>

An iterator over all registers in this context.

This iterator yields registers and values regardless of whether the register is valid. To get valid values, use valid_registers, instead.

source

fn valid_registers<'a>( &'a self, valid: &'a MinidumpContextValidity ) -> CpuRegisters<'a, Self>

An iterator over valid registers in this context.

This iterator yields valid registers and their values.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl CpuContext for CONTEXT_AMD64

§

type Register = u64

source§

const REGISTERS: &'static [&'static str] = _

source§

impl CpuContext for CONTEXT_ARM64

§

type Register = u64

source§

const REGISTERS: &'static [&'static str] = _

source§

impl CpuContext for CONTEXT_ARM64_OLD

§

type Register = u64

source§

const REGISTERS: &'static [&'static str] = _

source§

impl CpuContext for CONTEXT_ARM

§

type Register = u32

source§

const REGISTERS: &'static [&'static str] = _

source§

impl CpuContext for CONTEXT_MIPS

§

type Register = u64

source§

const REGISTERS: &'static [&'static str] = _

source§

impl CpuContext for CONTEXT_PPC64

§

type Register = u64

source§

const REGISTERS: &'static [&'static str] = _

source§

impl CpuContext for CONTEXT_PPC

§

type Register = u32

source§

const REGISTERS: &'static [&'static str] = _

source§

impl CpuContext for CONTEXT_SPARC

§

type Register = u64

source§

const REGISTERS: &'static [&'static str] = _

source§

impl CpuContext for CONTEXT_X86

§

type Register = u32

source§

const REGISTERS: &'static [&'static str] = _