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

Method loaded_code_by_pc

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

Looks up `pc`, an absolute program counter address, to see if it corresponds to any loaded code within this [`ModuleRegistry`]. Returns `None` if nothing is found, and otherwise returns the corresponding [`LoadedCode`] as well as a relative pc from the start of the code's text section if found.

(&self, pc: usize)

Source from the content-addressed store, hash-verified

157 /// corresponding [`LoadedCode`] as well as a relative pc from the start of
158 /// the code's text section if found.
159 fn loaded_code_by_pc(&self, pc: usize) -> Option<(&LoadedCode, usize)> {
160 let (_, code) = self
161 .loaded_code
162 .range(..=StoreCodePC::from_raw(pc))
163 .next_back()?;
164 let offset = StoreCodePC::offset_of(code.code.text_range(), pc)?;
165 Some((code, offset))
166 }
167
168 /// Consults this [`ModuleRegistry`] to see if `pc` corrseponds to any
169 /// previously-registered block of code.

Callers 2

store_code_by_pcMethod · 0.80
lookup_frame_infoMethod · 0.80

Calls 3

text_rangeMethod · 0.80
next_backMethod · 0.45
rangeMethod · 0.45

Tested by

no test coverage detected