Expand description
Wasmtime unwinder.
⚠️ Warning ⚠️: this crate is an internal-only crate for the Wasmtime project and is not intended for general use. APIs are not strictly reviewed for safety and usage outside of Wasmtime may have bugs. If you’re interested in using this feel free to file an issue on the Wasmtime repository to start a discussion about doing so, but otherwise be aware that your usage of this crate is not supported.
§wasmtime-unwinder
This crate implements an unwind info format, stack walking, and unwinding for Wasmtime. It includes logic that:
- Can walk the Wasmstack and visit each frame;
- Can find exception handlers using an efficient format serialized from Cranelift compilation metadata that can be mapped and used in-place from disk;
- Provides a “throw” helper that, when called from host code that has been invoked from Wasmcode, can find a handler; and a “resume” stub that can be invoked to transfer control to the corresponding handler.
Structs§
- Exception
Handler - Wasmtime exception table item, after parsing.
- Exception
Table - ExceptionTable deserialized from a serialized slice.
- Frame
- A stack frame within a Wasm stack trace.
- Frame
Cursor - A cursor over
Frames in a single activation of Wasm. - Handler
- Description of a frame on the stack that is ready to catch an exception.
- Unwind
Host - If we have the above host-specific implementations, we can
implement
Unwind.
Traits§
- Unwind
- Implementation necessary to unwind the stack, used by
Backtrace.
Functions§
- frame_
iterator ⚠ - Wrap
FrameCursorin a true iterator. - get_
stack_ pointer - Get the current stack pointer (at the time this function is executing). This may be used to check, e.g., approximate space remaining on a stack, but cannot be relied upon for anything exact because the stack pointer from within this function is read and the frame is later popped.
- visit_
frames ⚠ - Walk through a contiguous sequence of Wasm frames starting with
the frame at the given PC and FP and ending at
trampoline_fp. This FP should correspond to that of a trampoline that was used to enter the Wasm code.