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

Function lookup_code

crates/wasmtime/src/runtime/module/registry.rs:383–388  ·  view source on GitHub ↗

Find which registered region of code contains the given program counter, and what offset that PC is within that module's code.

(pc: usize)

Source from the content-addressed store, hash-verified

381/// Find which registered region of code contains the given program counter, and
382/// what offset that PC is within that module's code.
383pub fn lookup_code(pc: usize) -> Option<(Arc<CodeMemory>, usize)> {
384 let all_modules = global_code().read();
385 let (_end, (start, module)) = all_modules.range(pc..).next()?;
386 let text_offset = pc.checked_sub(*start)?;
387 Some((module.clone(), text_offset))
388}
389
390/// Registers a new region of code.
391///

Callers 2

test_if_trapMethod · 0.85
handle_exceptionFunction · 0.85

Calls 6

global_codeFunction · 0.85
checked_subMethod · 0.80
readMethod · 0.45
nextMethod · 0.45
rangeMethod · 0.45
cloneMethod · 0.45

Tested by 1

test_if_trapMethod · 0.68