opentitanlib::debug::elf_debugger

Struct ElfDebugger

Source
pub struct ElfDebugger<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> ElfDebugger<'a>

Source

pub fn disconnect(self) -> Result<()>

Source

pub fn resolve( &self, address: impl Into<SymbolicAddress>, ) -> Result<ResolvedAddress>

Source

pub fn read_reg(&mut self, reg: impl Into<RiscvReg>) -> Result<u32>

Read a RISC-V register.

This is a convience wrapper around read_riscv_reg provided by the JTAG trait.

Source

pub fn write_reg(&mut self, reg: impl Into<RiscvReg>, value: u32) -> Result<()>

Write a RISC-V register.

This is a convience wrapper around write_riscv_reg provided by the JTAG trait.

Source

pub fn read_u32(&mut self, addr: u32) -> Result<u32>

Read a 32-bit word from memory.

This is a convience wrapper around read_memory32 provided by the JTAG trait.

Source

pub fn write_u32(&mut self, addr: u32, value: u32) -> Result<()>

Write a 32-bit word to memory.

This is a convience wrapper around write_memory32 provided by the JTAG trait.

Source

pub fn get_pc(&mut self) -> Result<u32>

Read the program counter.

Source

pub fn set_pc(&mut self, address: impl Into<SymbolicAddress>) -> Result<()>

Set the program counter to the given address.

Source

pub fn set_breakpoint( &mut self, address: impl Into<SymbolicAddress>, ) -> Result<()>

Set a breakpoint at the given address.

Source

pub fn expect_pc(&mut self, address: impl Into<SymbolicAddress>) -> Result<()>

Assert the current program counter is at the given address.

Source

pub fn expect_pc_range( &mut self, range: Range<impl Into<SymbolicAddress>>, ) -> Result<()>

Assert the current program counter is within the given range.

Source

pub fn run_until( &mut self, address: impl Into<SymbolicAddress>, timeout: Duration, ) -> Result<()>

Continue execution until the address is hit.

Note that a breakpoint must not already exist for the target address, otherwise this function will fail.

This function will also fail if a pre-existing breakpoint is hit before the target address is hit.

Source

pub fn finish(&mut self, timeout: Duration) -> Result<()>

Execute until the current function returns.

This implementation does not use the debugging information from ELF files, and only uses the RA register, so it only works when RA has not been overriden, e.g. at the preamble of the function.

Source

pub fn call( &mut self, address: impl Into<SymbolicAddress>, args: &[u32], timeout: Duration, ) -> Result<(u32, u32)>

Call a function with the given arguments.

Trait Implementations§

Source§

impl<'a> Deref for ElfDebugger<'a>

Source§

type Target = dyn Jtag + 'a

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a> DerefMut for ElfDebugger<'a>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for ElfDebugger<'a>

§

impl<'a> !RefUnwindSafe for ElfDebugger<'a>

§

impl<'a> !Send for ElfDebugger<'a>

§

impl<'a> !Sync for ElfDebugger<'a>

§

impl<'a> Unpin for ElfDebugger<'a>

§

impl<'a> !UnwindSafe for ElfDebugger<'a>

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V