MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / wasm_function_index_and_pc

Method wasm_function_index_and_pc

crates/wasmtime/src/runtime/debug.rs:545–563  ·  view source on GitHub ↗

Get the raw function index associated with the current frame, and the module-relative PC as an offset within the module binary, if this is a Wasm function directly from the given `Module` (rather than a trampoline).

(
        &self,
        mut store: impl AsContextMut,
    )

Source from the content-addressed store, hash-verified

543 /// this is a Wasm function directly from the given `Module`
544 /// (rather than a trampoline).
545 pub fn wasm_function_index_and_pc(
546 &self,
547 mut store: impl AsContextMut,
548 ) -> Result<Option<(DefinedFuncIndex, ModulePC)>> {
549 let mut store = store.as_context_mut();
550 let frame_data = self.frame_data(store.0.as_store_opaque())?;
551 let FuncKey::DefinedWasmFunction(module, func) = frame_data.func_key else {
552 return Ok(None);
553 };
554 let wasm_pc = frame_data.wasm_pc;
555 debug_assert_eq!(
556 module,
557 self.module(&mut store)?
558 .expect("module should be defined if this is a defined function")
559 .env_module()
560 .module_index
561 );
562 Ok(Some((func, wasm_pc)))
563 }
564
565 /// Get the number of locals in this frame.
566 pub fn num_locals(&self, mut store: impl AsContextMut) -> Result<u32> {

Callers 4

handleMethod · 0.80
pulley_provenance_testFunction · 0.80
frame_func_and_pcMethod · 0.80

Calls 4

OkFunction · 0.85
frame_dataMethod · 0.80
as_store_opaqueMethod · 0.80
as_context_mutMethod · 0.45

Tested by

no test coverage detected