Registers

Struct Registers 

Source
pub struct Registers {
    pub registers: HashMap<u16, u32>,
    pub program_counter_register: Option<usize>,
    pub link_register: Option<usize>,
    pub stack_pointer_register: Option<usize>,
    pub cfa: Option<u32>,
    /* private fields */
}
Expand description

A struct to hold the register values and other register information.

Fields§

§registers: HashMap<u16, u32>

Holds all the register values.

§program_counter_register: Option<usize>

The register number which is the program counter register.

§link_register: Option<usize>

The register number which is the link register.

§stack_pointer_register: Option<usize>

The register number which is the stack pointer register.

§cfa: Option<u32>

Canonical Frame Address, which is sometimes needed to evaluate variables.

Implementations§

Source§

impl Registers

Source

pub fn add_register_value(&mut self, register: u16, value: u32)

Add a register value to the struct.

Description:

  • register - The register to add a value for.
  • value - The value that will be stored for that registry.

This function will add the value to the self.registers HashMap with register as the hash number.

Source

pub fn get_register_value(&self, register: &u16) -> Option<&u32>

Retrieve a register value.

Description:

  • register - The register to get the value from.

Will retrieve the register value from the self.registers HashMap.

Source

pub fn clear(&mut self)

Sets all the register values to None in the struct.

Source

pub fn stash_registers(&mut self)

Temporally stash the current register values.

Description:

The current register values will be stashed allowing for other register values to be used in the evaluation of variables. This is only used when evaluating StackFrames because preserved register values need to be used in the evaluation.

Source

pub fn pop_stashed_registers(&mut self)

Pop the stashed register values.

Description:

This is used to pop back the stashed registers into self.registers. This function is only called after doing a stack trace because preserved register values is used for evaluating the StackFrames.

Source

pub fn get_registers_as_list(&self) -> Vec<(u16, u32)>

Get registers as a Vec of Variables

Description:

This is used to get the register as a Vec of Variables.

Trait Implementations§

Source§

impl Clone for Registers

Source§

fn clone(&self) -> Registers

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Registers

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Registers

Source§

fn default() -> Registers

Creates a empty Registers struct.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.