Make the trap name for unreachable traps more descriptive. (#3568)

Following up on WebAssembly/wasi-sdk#210, this makes the trap message
for `unreachable` traps more descriptive of what actually caused the
trap, so that it doesn't sound like maybe Wasmtime itself executed a
`unreachable!()` macro in Rust.

Before:
```
wasm trap: unreachable
wasm backtrace:
     [...]
```

After:
```
wasm trap: wasm `unreachable` instruction executed
wasm backtrace:
     [...]
```
This commit is contained in:
Dan Gohman
2021-11-29 15:55:10 -08:00
committed by GitHub
parent b1a40646e3
commit 42b23dac4a
2 changed files with 6 additions and 6 deletions

View File

@@ -160,7 +160,7 @@ fn trap_display_pretty() -> Result<()> {
assert_eq!(
e.to_string(),
"\
wasm trap: unreachable
wasm trap: wasm `unreachable` instruction executed
wasm backtrace:
0: 0x23 - m!die
1: 0x27 - m!<wasm function 1>
@@ -206,7 +206,7 @@ fn trap_display_multi_module() -> Result<()> {
assert_eq!(
e.to_string(),
"\
wasm trap: unreachable
wasm trap: wasm `unreachable` instruction executed
wasm backtrace:
0: 0x23 - a!die
1: 0x27 - a!<wasm function 1>
@@ -400,7 +400,7 @@ fn start_trap_pretty() -> Result<()> {
assert_eq!(
e.to_string(),
"\
wasm trap: unreachable
wasm trap: wasm `unreachable` instruction executed
wasm backtrace:
0: 0x1d - m!die
1: 0x21 - m!<wasm function 1>
@@ -565,7 +565,7 @@ fn no_hint_even_with_dwarf_info() -> Result<()> {
assert_eq!(
trap.to_string(),
"\
wasm trap: unreachable
wasm trap: wasm `unreachable` instruction executed
wasm backtrace:
0: 0x1a - <unknown>!start
"
@@ -600,7 +600,7 @@ fn hint_with_dwarf_info() -> Result<()> {
assert_eq!(
trap.to_string(),
"\
wasm trap: unreachable
wasm trap: wasm `unreachable` instruction executed
wasm backtrace:
0: 0x1a - <unknown>!start
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable to may show more debugging information