mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
wasm_interp: print function names in stack trace if available
This commit is contained in:
parent
a3b5a9d9a2
commit
75b21e6228
1 changed files with 10 additions and 1 deletions
|
|
@ -1808,8 +1808,17 @@ impl<'a, I: ImportDispatcher> Instance<'a, I> {
|
|||
self.module.types.look_up(signature_index).0.len()
|
||||
};
|
||||
|
||||
let fn_name = self
|
||||
.module
|
||||
.names
|
||||
.function_names
|
||||
.iter()
|
||||
.find(|(idx, _)| *idx == *fn_index as u32)
|
||||
.map(|(_, name)| *name)
|
||||
.unwrap_or("");
|
||||
|
||||
// Function and address match wasm-objdump formatting, for easy copy & find
|
||||
writeln!(buffer, "func[{}]", fn_index)?;
|
||||
writeln!(buffer, "func[{}] {}", fn_index, fn_name)?;
|
||||
writeln!(buffer, " address {:06x}", execution_addrs.next().unwrap())?;
|
||||
|
||||
write!(buffer, " args ")?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue