Stream: wasmtime

Topic: ✔ debug wasm


view this post on Zulip Harald Hoyer (Oct 14 2022 at 13:26):

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

view this post on Zulip Harald Hoyer (Oct 14 2022 at 13:28):

does 0x2b6 correspond to the address printed with objdump -d ?

view this post on Zulip Joel Dice (Oct 14 2022 at 13:57):

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/

Low level tooling for WebAssembly in Rust. Contribute to bytecodealliance/wasm-tools development by creating an account on GitHub.

view this post on Zulip Harald Hoyer (Oct 14 2022 at 14:37):

perfect! @Joel Dice Thank you!

view this post on Zulip Harald Hoyer (Oct 14 2022 at 14:37):

(;@2b6   ;)        memory.atomic.notify

view this post on Zulip Lann Martin (Oct 14 2022 at 14:46):

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

view this post on Zulip Harald Hoyer (Oct 14 2022 at 14:47):

Lann Martin thanks!

view this post on Zulip Harald Hoyer (Oct 14 2022 at 14:50):

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(),
    )

view this post on Zulip Notification Bot (Oct 28 2022 at 14:39):

Harald Hoyer has marked this topic as resolved.


Last updated: Nov 22 2024 at 16:03 UTC