Skip to main content

State

Struct State 

Source
pub struct State<'a> { /* private fields */ }
Expand description

Runtime state shared with progress callbacks and handlers.

Implementations§

Source§

impl<'a> State<'a>

Source

pub fn new(pid: Pid, dwarf: Option<&'a Dwarf<'a>>) -> Self

Create a new runtime State for the given pid.

§Arguments
  • pid - The PID of the traced process.
  • dwarf - Optional DWARF info used for source lookups.
§Returns

A freshly-initialized State ready for tracing.

Source

pub fn pid(&self) -> Pid

Return the PID associated with this state.

§Returns

The Pid belonging to the traced process.

Source

pub fn addr2line(&self, addr: u64) -> Result<Option<LineInfo>>

Resolve an address to DWARF line information when available.

§Arguments
  • addr - The target runtime address to resolve.
§Returns

Ok(Some(LineInfo)) when DWARF had a mapping, Ok(None) when no mapping is available.

§Errors

Returns Err if a DWARF lookup failure occurs during address resolution.

Source

pub fn initial_layout(&self) -> Layout

Return the initial layout computed from available DWARF.

§Returns

The initial Layout chosen based on whether DWARF is available.

Source

pub fn layout(&self) -> &Layout

Return the currently active layout.

§Returns

A reference to the current Layout.

Source

pub fn set_layout(&mut self, layout: Layout)

Set the active layout.

§Arguments
  • layout - The new Layout to activate.
Source

pub fn set_requested_layout(&mut self, layout: Layout)

Request a new layout which will be applied by the tracer loop.

§Arguments
  • layout - The requested Layout which will be applied asynchronously by the tracer loop.
Source

pub fn take_requested_layout(&mut self) -> Option<Layout>

Take and return any requested layout.

§Returns

Some(Layout) when a layout was requested, otherwise None.

Source

pub fn breakpoint_mgr(&mut self) -> &mut Manager

Mutable access to the breakpoint manager owned by the state.

§Returns

A mutable reference to the internal breakpoint::Manager.

Source

pub fn print_breakpoints(&self)

Print the currently registered breakpoints to stdout.

This function writes the breakpoint manager’s display representation to stdout.

Source

pub fn prev_rip(&self) -> Option<u64>

Return the previous RIP (if set).

§Returns

The previous RIP value if one has been recorded.

Source

pub fn set_prev_rip(&mut self, rip: u64)

Set the previous RIP value.

§Arguments
  • rip - The RIP value to record as previous.
Source

pub fn printed(&self) -> Option<&String>

Return the last printed text (if any).

§Returns

An optional reference to the last printed string.

Source

pub fn set_printed(&mut self, printed: Option<String>)

Set the last printed text.

§Arguments
  • printed - Optional string to record as the last printed text.
Source

pub fn execution(&self) -> &Execution

Return the current execution state.

§Returns

A reference to the Execution enum representing the current execution state.

Source

pub fn set_execution(&mut self, execution: Execution)

Update the execution state.

§Arguments
  • execution - The new Execution state to apply.
Source

pub fn mode(&self) -> &Mode

Return the current tracing mode.

§Returns

A reference to the current Mode used for tracing.

Source

pub fn set_mode(&mut self, mode: Mode)

Set the tracing mode.

§Arguments
  • mode - The new Mode to set for tracing.

Auto Trait Implementations§

§

impl<'a> Freeze for State<'a>

§

impl<'a> RefUnwindSafe for State<'a>

§

impl<'a> Send for State<'a>

§

impl<'a> Sync for State<'a>

§

impl<'a> Unpin for State<'a>

§

impl<'a> UnsafeUnpin for State<'a>

§

impl<'a> UnwindSafe for State<'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<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.