pub struct FrameHandle { /* private fields */ }Expand description
A handle to a stack frame, valid as long as execution is not
resumed in the associated Store.
This handle can be held and cloned and used to refer to a frame within a paused store. It is cheap: it internally consists of a pointer to the actual frame, together with some metadata to determine when that pointer has gone stale.
At the API level, any usage of this frame handle requires a
mutable borrow of the Store, because the Store logically owns
the stack(s) for any execution within it. However, the existence
of the handle itself does not hold a borrow on the Store; hence,
the Store can continue to be used and queried, and some state
(e.g. memories, tables, GC objects) can even be mutated, as long
as execution is not resumed. The intent of this API is to allow a
wide variety of debugger implementation strategies that expose
stack frames and also allow other commands/actions at the same
time.
The user can use FrameHandle::is_valid to determine if the
handle is still valid and usable.
Implementations§
Source§impl FrameHandle
impl FrameHandle
Sourcepub fn is_valid(&self, store: impl AsContextMut) -> bool
pub fn is_valid(&self, store: impl AsContextMut) -> bool
Determine whether this handle can still be used to refer to a frame.
Sourcepub fn parent(
&self,
store: impl AsContextMut,
) -> Result<Option<FrameHandle>, Error>
pub fn parent( &self, store: impl AsContextMut, ) -> Result<Option<FrameHandle>, Error>
Get a handle to the next frame up the activation (the one that called this frame), if any.
Sourcepub fn instance(&self, store: impl AsContextMut) -> Result<Instance, Error>
pub fn instance(&self, store: impl AsContextMut) -> Result<Instance, Error>
Get the instance associated with the current frame.
Sourcepub fn module<'a, T>(
&self,
store: impl Into<StoreContextMut<'a, T>>,
) -> Result<Option<&'a Module>, Error>where
T: 'static,
pub fn module<'a, T>(
&self,
store: impl Into<StoreContextMut<'a, T>>,
) -> Result<Option<&'a Module>, Error>where
T: 'static,
Get the module associated with the current frame, if any (i.e., not a container instance for a host-created entity).
Sourcepub fn wasm_function_index_and_pc(
&self,
store: impl AsContextMut,
) -> Result<Option<(DefinedFuncIndex, u32)>, Error>
pub fn wasm_function_index_and_pc( &self, store: impl AsContextMut, ) -> Result<Option<(DefinedFuncIndex, u32)>, Error>
Get the raw function index associated with the current frame, and the
PC as an offset within its code section, if it is a Wasm
function directly from the given Module (rather than a
trampoline).
Sourcepub fn num_locals(&self, store: impl AsContextMut) -> Result<u32, Error>
pub fn num_locals(&self, store: impl AsContextMut) -> Result<u32, Error>
Get the number of locals in this frame.
Sourcepub fn num_stacks(&self, store: impl AsContextMut) -> Result<u32, Error>
pub fn num_stacks(&self, store: impl AsContextMut) -> Result<u32, Error>
Get the depth of the operand stack in this frame.
Sourcepub fn local(&self, store: impl AsContextMut, index: u32) -> Result<Val, Error>
pub fn local(&self, store: impl AsContextMut, index: u32) -> Result<Val, Error>
Get the type and value of the given local in this frame.
§Panics
Panics if the index is out-of-range (greater than
num_locals()).
Sourcepub fn stack(&self, store: impl AsContextMut, index: u32) -> Result<Val, Error>
pub fn stack(&self, store: impl AsContextMut, index: u32) -> Result<Val, Error>
Get the type and value of the given operand-stack value in this frame.
Index 0 corresponds to the bottom-of-stack, and higher indices from there are more recently pushed values. In other words, index order reads the Wasm virtual machine’s abstract stack state left-to-right.
Trait Implementations§
Source§impl Clone for FrameHandle
impl Clone for FrameHandle
Source§fn clone(&self) -> FrameHandle
fn clone(&self) -> FrameHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for FrameHandle
impl RefUnwindSafe for FrameHandle
impl Send for FrameHandle
impl Sync for FrameHandle
impl Unpin for FrameHandle
impl UnwindSafe for FrameHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more