How would I debug the wasm execution of a failure like:
0: failed to invoke `_start`
1: wasm trap: out of bounds memory access
wasm backtrace:
0: 0x2b6 - <unknown>!__wasm_init_memory
does 0x2b6 correspond to the address printed with objdump -d
?
That's the offset into the .wasm file where you'll find the instruction that caused the trap. I've found wasm-tools print --print-offsets foo.wasm
to be useful when debugging such cases. You can get wasm-tools here: https://github.com/bytecodealliance/wasm-tools/
perfect! @Joel Dice Thank you!
(;@2b6 ;) memory.atomic.notify
This came up for someone else recently: https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime/topic/Got.20out.20of.20bounds.20memory.20access.20from.20memory.2Eatomic.2Enotify/near/300167134
Lann Martin thanks!
crates/runtime/src/libcalls.rs
// Implementation of `memory.atomic.notify` for locally defined memories.
unsafe fn memory_atomic_notify(
// …
Err(
anyhow::anyhow!("unimplemented: wasm atomics (fn memory_atomic_notify) unsupported",)
.into(),
)
Harald Hoyer has marked this topic as resolved.
Last updated: Nov 22 2024 at 16:03 UTC