-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging & Breakpoints #305
Comments
Ok I did get breakpoints to work for the fib-debug example now, I just had to add "settings set plugin.jit-loader.gdb.enable on" to launch.json, so it looks like this now (this is osx specific, see: bytecodealliance/wasmtime#1953): {
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "lldb",
"request": "launch",
"program": "target/debug/fib-debug",
"args": [],
"initCommands": [
"settings set plugin.jit-loader.gdb.enable on"
]
},
]
} I tried the same with ambient but it didn't work (yet) |
@philpax Hm I think it might be something about it not finding the right files; I noticed that in the fib-debug example they have this line: let module = Module::from_file(&engine, "target/wasm32-unknown-unknown/debug/fib.wasm")?; but I can't find anything like that in our code. Is there some place where it might be setting up what the local path is to the source files? |
Hm, our setup is a little finicky.
Ambient/crates/build/src/lib.rs Lines 105 to 113 in fc3ae02
The component bytecode is then loaded into the ECS: Ambient/app/src/server/wasm.rs Lines 64 to 71 in fc3ae02
Some indirection later, the WASM is instantiated with the bytecode: Ambient/crates/wasm/src/shared/module.rs Lines 191 to 198 in fc3ae02
If I were to guess, the componentization process might be interfering. That being said, neither I'd peek around the textual WebAssembly for both |
This might be relevant: https://marketplace.visualstudio.com/items?itemName=ms-vscode.wasm-dwarf-debugging (thanks to ju_rstr in the discord!) |
The next release of wasm-bindgen should have this merged in rustwasm/walrus#244 |
Nice. I tried debugging wasm going as manual as possible through both commandline lldb, gdb, and rust-lldb. I could sortof get it to work, but was not able to get the original rust code or function named breakpoints to work, though I did manage to stop inside the wasm on panics and other traps. |
@nuno, I think you may have misunderstood the issue. This is about debugging guest code jitted wasm run inside wasmtime, which does not use wasm-bindgen at all. wasm-bindgen is only used to bind to javascript APIs and functions such as |
But it would be helpful if we could debug and set breakpoints with the browser, right? |
New projects now have a
launch.json
(for vscode) which launches the project with code-lldb. This works fine, except it doesn't seem to handle debugging/breakpoints yet.I tried adding
.debug_info(true)
on wasmtimes'sConfig
, but it didn't seem to have any effect.There's this example in wasmtime; https://docs.wasmtime.dev/examples-rust-debugging.html but I couldn't get that to work with breakpoints either.
The text was updated successfully, but these errors were encountered: