-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixingcranelift:area:debugwasmtime:debuggingIssues related to debugging of JIT'ed codeIssues related to debugging of JIT'ed code
Description
Test Case
Steps to Reproduce
The .wasm file was created with:
clang --target=wasm32-wasip2 --sysroot=$HOME/wasi-libc/sysroot -o function-pointer.wasm function-pointer.c -g -O0
and wasi-libc was built from source.
function-pointer.c is as follows:
struct myfile {
int data;
void (*f)();
} myfile;
void f() {}
int foo(struct myfile* f1) {
f1->f();
// If the above line is commented out and the next line is uncommented,
// it works as expected
// f()
if (f1->data == 42)
return 0;
return 1;
}
int main() {
struct myfile f1;
f1.f = &f;
f1.data = 42;
return foo(&f1);
}
Steps:
lldb -- wasmtime run -D debug-info -O opt-level=0 --wasm component-model --dir .::/ function-pointer.wasm
(lldb) b foo
(lldb) run
(lldb) p f1
(WebAssemblyPtrWrapper<myfile>) (__ptr = 199872)
(lldb) n
(lldb) p f1
error: Couldn't materialize: couldn't get the value of variable f1: variable not available
error: errored out in DoExecute, couldn't PrepareToExecuteJITExpression
Expected Results
I would expect to be able to view f1 in the debugger at any point during the execution of foo().
Actual Results
"Couldn't materialize" error as above.
Versions and Environment
Wasmtime version or commit: 35.0.0
lldb version: 18.1.3
Operating system: Linux (Ubuntu 24.04)
Architecture: x86_64
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixingcranelift:area:debugwasmtime:debuggingIssues related to debugging of JIT'ed codeIssues related to debugging of JIT'ed code