pub struct FrameHandle { /* private fields */ }debug only.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
Available on crate feature runtime only.
pub fn is_valid(&self, store: impl AsContextMut) -> bool
runtime only.Determine whether this handle can still be used to refer to a frame.
Sourcepub fn parent(&self, store: impl AsContextMut) -> Result<Option<FrameHandle>>
Available on crate feature runtime only.
pub fn parent(&self, store: impl AsContextMut) -> Result<Option<FrameHandle>>
runtime only.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>
Available on crate feature runtime only.
pub fn instance(&self, store: impl AsContextMut) -> Result<Instance>
runtime only.Get the instance associated with the current frame.
Sourcepub fn module<'a, T: 'static>(
&self,
store: impl Into<StoreContextMut<'a, T>>,
) -> Result<Option<&'a Module>>
Available on crate feature runtime only.
pub fn module<'a, T: 'static>( &self, store: impl Into<StoreContextMut<'a, T>>, ) -> Result<Option<&'a Module>>
runtime only.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)>>
Available on crate feature runtime only.
pub fn wasm_function_index_and_pc( &self, store: impl AsContextMut, ) -> Result<Option<(DefinedFuncIndex, u32)>>
runtime only.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>
Available on crate feature runtime only.
pub fn num_locals(&self, store: impl AsContextMut) -> Result<u32>
runtime only.Get the number of locals in this frame.
Sourcepub fn num_stacks(&self, store: impl AsContextMut) -> Result<u32>
Available on crate feature runtime only.
pub fn num_stacks(&self, store: impl AsContextMut) -> Result<u32>
runtime only.Get the depth of the operand stack in this frame.
Sourcepub fn local(&self, store: impl AsContextMut, index: u32) -> Result<Val>
Available on crate feature runtime only.
pub fn local(&self, store: impl AsContextMut, index: u32) -> Result<Val>
runtime only.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>
Available on crate feature runtime only.
pub fn stack(&self, store: impl AsContextMut, index: u32) -> Result<Val>
runtime only.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
Available on crate feature runtime only.
impl Clone for FrameHandle
runtime only.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,
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