bytecodealliance / bytecodealliance/wasmtime
Use a reasonable default for module names in Wasmtime backtraces
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
## Repro
1. Create a Rust wasm file that simply panics in main.
2. Run the wasm with `wasmtime foo.wasm`
## Expected behavior
As the module doesn't declare a module name, Wasmtime should provide a meaningful default based on the file name for displaying in back traces. In this case, perhaps `foo` would be a good name (i.e. the name of the file name without the extension).
## Actual behavior
Wasmtime prints `` for module names, which can be confusing. Additionally, calls between modules without names will be even harder to decipher.
An example from a user:
```
1: wasm trap: unreachable
wasm backtrace:
0: 0x6c34 - !__rust_start_panic
1: 0x68df - !rust_panic
2: 0x65b9 - !std::panicking::rust_panic_with_hook::h2345fb0909b53e12
3: 0x10c7 - !std::panicking::begin_panic::{{closure}}::h86678b4e45fbd7fa
4: 0x1ccc - !std::sys_common::backtrace::__rust_end_short_backtrace::h8c7fe73fc6112e0e
5: 0xfb5 - !std::panicking::begin_panic::h5a83b3bb18195122
6: 0x1fed - !wasm_backtrace::g::hc5f9230a6e65a92c
7: 0x1fbf - !wasm_backtrace::f::h80747d9c660ceee4
8: 0x1fb5 - !wasm_backtrace::main::h9fc5985544d26b7b
9: 0x1bee - !core::ops::function::FnOnce::call_once::hfd088d5879747b81
10: 0x1d03 - !std::sys_common::backtrace::__rust_begin_short_backtrace::h2d7439e32125816a
11: 0x4a5 - !std::rt::lang_start::{{closure}}::hc9be9987846fa67a
12: 0x69f0 - !std::rt::lang_start_internal::h260050c92cd470af
13: 0x457 - !std::rt::lang_start::hd15e4b73e676a12b
14: 0x200b - !__original_main
15: 0x397 - !_start
```
Contributor guide
Assessment
This issue has not been assessed yet.