Stream: git-wasmtime

Topic: wasmtime / issue #8752 Source-level DWARF debugging with ...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 06 2024 at 20:57):

alexcrichton opened issue #8752:

Spinning off https://github.com/bytecodealliance/wasmtime/issues/7278#issuecomment-2152906576 into its own issue I've done a local bisection that points to https://github.com/bytecodealliance/wasmtime/pull/5843 as the source of where some DWARF debugging broke a long time ago. My bisection script was:

set -ex

cargo build

rustc \
  examples/fib-debug/wasm/fib.rs \
  --crate-type cdylib \
  -C debuginfo=2 \
  -o ./fib.wasm \
  --target wasm32-unknown-unknown \
  -C incremental=./target/tmp-incremental

# lldb \
#   --one-line 'b fib.rs:7' \
#   --one-line 'run' \
#   --one-line 'fr v' \
#   --one-line 'exit' \
#   -- \
#   ./target/debug/wasmtime run \
#     -Ccache=n \
#     -Ddebug-info \
#     -Oopt-level=0 \
#     --invoke fib \
#     ./fib.wasm 5

lldb \
  --one-line 'b fib.rs:7' \
  --one-line 'run' \
  --one-line 'fr v' \
  --one-line 'exit' \
  -- \
  ./target/debug/wasmtime run \
    --disable-cache \
    -g \
    --opt-level 0 \
    --invoke fib \
    ./fib.wasm 5

Where on this commit it prints:

$ sh foo.sh
...
(lldb) fr v
(WasmtimeVMContext *) __vmctx = <variable not available>

(unsigned int) n = <variable not available>

(lldb) exit

but before the commit it prints:

$ sh foo.sh
...
(lldb) fr v
(WasmtimeVMContext *) __vmctx = 0x0000555557671860
(unsigned int) n = 5
(unsigned int) a = 1
(unsigned int) b = 1
(core::ops::range::Range<unsigned int>) iter = (start = 1, end = 5)
(unsigned int) t = 1
(lldb) exit

Interestingly if you compile without -Cincremental then the debugging works fine on main. I don't know whether that's related or if #5843 is the main culprit.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 07 2024 at 06:31):

pgherveou commented on issue #8752:

Ah nice, thanks for digging into this @alexcrichton
I was able to debug the fib example using

CARGO_INCREMENTAL=0 cargo build -p example-fib-debug-wasm --target wasm32-unknown-unknown

view this post on Zulip Wasmtime GitHub notifications bot (Jun 10 2024 at 22:22):

alexcrichton closed issue #8752:

Spinning off https://github.com/bytecodealliance/wasmtime/issues/7278#issuecomment-2152906576 into its own issue I've done a local bisection that points to https://github.com/bytecodealliance/wasmtime/pull/5843 as the source of where some DWARF debugging broke a long time ago. My bisection script was:

set -ex

cargo build

rustc \
  examples/fib-debug/wasm/fib.rs \
  --crate-type cdylib \
  -C debuginfo=2 \
  -o ./fib.wasm \
  --target wasm32-unknown-unknown \
  -C incremental=./target/tmp-incremental

# lldb \
#   --one-line 'b fib.rs:7' \
#   --one-line 'run' \
#   --one-line 'fr v' \
#   --one-line 'exit' \
#   -- \
#   ./target/debug/wasmtime run \
#     -Ccache=n \
#     -Ddebug-info \
#     -Oopt-level=0 \
#     --invoke fib \
#     ./fib.wasm 5

lldb \
  --one-line 'b fib.rs:7' \
  --one-line 'run' \
  --one-line 'fr v' \
  --one-line 'exit' \
  -- \
  ./target/debug/wasmtime run \
    --disable-cache \
    -g \
    --opt-level 0 \
    --invoke fib \
    ./fib.wasm 5

Where on this commit it prints:

$ sh foo.sh
...
(lldb) fr v
(WasmtimeVMContext *) __vmctx = <variable not available>

(unsigned int) n = <variable not available>

(lldb) exit

but before the commit it prints:

$ sh foo.sh
...
(lldb) fr v
(WasmtimeVMContext *) __vmctx = 0x0000555557671860
(unsigned int) n = 5
(unsigned int) a = 1
(unsigned int) b = 1
(core::ops::range::Range<unsigned int>) iter = (start = 1, end = 5)
(unsigned int) t = 1
(lldb) exit

Interestingly if you compile without -Cincremental then the debugging works fine on main. I don't know whether that's related or if #5843 is the main culprit.


Last updated: Dec 23 2024 at 12:05 UTC