(name: String, module: &Module)
| 262 | } |
| 263 | |
| 264 | fn 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 | |
| 305 | fn lookup_frames<'a>( |
| 306 | modules: &'a Modules, |
no test coverage detected