Stream: wasmtime

Topic: Debugging: variable values not available?


view this post on Zulip Peter Vetere (Jun 20 2022 at 19:56):

Hi. I've seen this topic mentioned here before, and am hoping someone can help me better understand the reason for the behavior.

The symptom is that when I am running a Wasm program in a debugger (I've tried both GDB and LLDB), I am unable to inspect the value of local variables. The names are visible, but the value shows as "optimized out" or "not available". I've verified that the module I am using has been compiled in debug mode, and that wasmtime is configured for "debug_info".

I found a related bug report from a few months ago (https://github.com/bytecodealliance/wasmtime/issues/3884), which seems to say that it did indeed work once.

The context for my question is that I writing some documentation to explain a possible development workflow for creating server-side Wasm modules, and one of the subjects I'd like to touch on is debugging. My readers are going to be surprised that local variable values are unavailable, and I'd like to explain why at a very high level (even if only to give an assurance that it will be fixed soon).

Thanks!
Pete

Test Case test.wasm.zip #include <stdio.h> int main() { int i; for(i = 0; i < 5; i++) { printf("%d\n", i); } return 0; } compiled with: wasi-sdk-14.0/bin/clang -g -O0 test.c -o t...

view this post on Zulip Alex Crichton (Jun 20 2022 at 20:57):

In general the LLDB/GDB DWARF debugging support from Wasmtime is quite experimental and hasn't really seen much development since it was first added. There are likely bugs with it and you're probably running into such a bug here. It would be good to categorize these test cases perhaps but otherwise I wouldn't rely on the current support too much since it likely needs improvement to be more robust.

view this post on Zulip Peter Vetere (Jun 20 2022 at 21:10):

Completely reasonable answer. Thank you so much; I'll convey that message.


Last updated: Oct 23 2024 at 20:03 UTC