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

Function module_symbols

crates/wasmtime/src/runtime/profiling.rs:264–303  ·  view source on GitHub ↗
(name: String, module: &Module)

Source from the content-addressed store, hash-verified

262}
263
264fn module_symbols(name: String, module: &Module) -> Option<LibraryInfo> {
265 let compiled = module.compiled_module();
266 let symbols = Vec::from_iter(
267 module
268 .env_module()
269 .defined_func_indices()
270 .map(|defined_idx| {
271 let key =
272 FuncKey::DefinedWasmFunction(module.env_module().module_index, defined_idx);
273 let loc = compiled.func_loc(key);
274 let func_idx = compiled.module().func_index(defined_idx);
275 let mut name = String::new();
276 demangle_function_name_or_index(
277 &mut name,
278 compiled.func_name(func_idx),
279 defined_idx.as_u32() as usize,
280 )
281 .unwrap();
282 Symbol {
283 address: loc.start,
284 size: Some(loc.length),
285 name,
286 }
287 }),
288 );
289 if symbols.is_empty() {
290 return None;
291 }
292
293 Some(LibraryInfo {
294 name,
295 debug_name: String::new(),
296 path: String::new(),
297 debug_path: String::new(),
298 debug_id: DebugId::nil(),
299 code_id: None,
300 arch: None,
301 symbol_table: Some(Arc::new(SymbolTable::new(symbols))),
302 })
303}
304
305fn lookup_frames<'a>(
306 modules: &'a Modules,

Callers 1

newMethod · 0.85

Calls 14

from_iterFunction · 0.85
compiled_moduleMethod · 0.80
defined_func_indicesMethod · 0.80
newFunction · 0.50
mapMethod · 0.45
env_moduleMethod · 0.45
func_locMethod · 0.45
func_indexMethod · 0.45
moduleMethod · 0.45
unwrapMethod · 0.45
func_nameMethod · 0.45

Tested by

no test coverage detected