You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run the fib-debug executable inside lldb with the jit plugin enabled.
> lldb -- ./target/debug/examples/fib-debug
(lldb) target create "./target/debug/examples/fib-debug"
Current executable set to '/Users/bkolobara/dev/wasmtime/target/debug/examples/fib-debug' (arm64).
(lldb) settings set plugin.jit-loader.gdb.enable on
(lldb) b fib.rs:6
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) r
Process 87206 launched: '/Users/bkolobara/dev/wasmtime/target/debug/examples/fib-debug' (arm64)
1 location added to breakpoint 1
Process 87206 stopped
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00000001041381c4 JIT(0x1381c8000)`fib(n=<unavailable>) at fib.rs:6:17
3 let mut a = 1;
4 let mut b = 1;
5 for _ in 0..n {
-> 6 let t = a;
7 a = b;
8 b += t;
9 }
Target 0: (fib-debug) stopped.
warning: This version of LLDB has no plugin for the language "rust". Inspection of frame variables will be limited.
(lldb) fr v
(WasmtimeVMContext *) __vmctx = <variable not available>
(unsigned int) n = <read memory from 0xffff8 failed (0 of 4 bytes read)>
(unsigned int) a = <no location, value may have been optimized out>
(unsigned int) b = <no location, value may have been optimized out>
(core::ops::range::Range<unsigned int>) iter = <no location, value may have been optimized out>
Expected Results
Running fr v in lldb in this context should display the values of the variables:
(unsigned int) a = 1
(unsigned int) b = 1
Actual Results
(unsigned int) a = <no location, value may have been optimized out>
(unsigned int) b = <no location, value may have been optimized out>
Versions and Environment
Wasmtime version or commit: 27.0
Operating system: macOs Sequoia 15.1.1
Architecture: Apple M1 Pro
Extra Info
> lldb --version
lldb-1600.0.39.3
Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
There was a similar issue #3884, but it was closed as fixed 2 years ago.
I'm also aware that there is some work being done on improving the debug info translation in #5537.
The text was updated successfully, but these errors were encountered:
bkolobara
added
the
bug
Incorrect behavior in the current implementation that needs fixing
label
Dec 3, 2024
Hmm, not immediately, considering this is trivial code at -Oopt-level=0. What is the Rust->WASM optimization level here?
Generically, non-trivial examples do fall apart very easily because SSA+RA do not preserve everything, and so Cranelift's preservation of variable ranges is quite poor.
The way to self-diagnose this is to look at the DWARF produced for WASM, check if a and b in it have reasonable ranges, then in LLDB do:
(lldb) image lookup -r -n fib --verbose
And check the coverage for ranges that will be dumped.
I'm trying to get the following example working inside of a debugger: https://docs.wasmtime.dev/examples-rust-debugging.html, but lldb can't read any of the local variables when a break point is triggered.
Test Case
The wasm file and executable are compiled directly from wasmtime examples.
Steps to Reproduce
Run the
fib-debug
executable inside lldb with the jit plugin enabled.Expected Results
Running
fr v
in lldb in this context should display the values of the variables:Actual Results
Versions and Environment
Wasmtime version or commit: 27.0
Operating system: macOs Sequoia 15.1.1
Architecture: Apple M1 Pro
Extra Info
There was a similar issue #3884, but it was closed as fixed 2 years ago.
I'm also aware that there is some work being done on improving the debug info translation in #5537.
The text was updated successfully, but these errors were encountered: