Repository navigation
Debugging Rust Web Assembly #65313
SGumbles
started this conversation in
Show and tell
Replies: 1 comment
|
Would be happy to attempt the leg work and make a PR if this is something people would be interested in! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Apologies if this is a newbie thing to have discovered.
I'm brand new to Zed having just made the switch over from VS Code. One of the things I liked about VS Code was you can set breakpoints on your Rust code and they will get hit from a debugging session in Chrome. This wasn't happening in Zed so I (errr ahh, *cough cough* AI) did some digging and found this trick.
~/.local/share/zed/debug_adapters/JavaScript/JavaScript_v1.140.0/js-debug, into a temporary folder at~/zed-js-debug-dwarfjs-debugin that directory I rannpm install @vscode/dwarf-debuggingThat was essentially it. This is my debug config file
{ "adapter": "JavaScript", "label": "Launch Chrome (Trunk)", "type": "chrome", "request": "launch", "url": "http://127.0.0.1:8080/", "webRoot": "$ZED_WORKTREE_ROOT/dist", "runtimeExecutable": "<MY HOME DIR>/.cache/ms-playwright/chromium-1243/chrome-linux64/chrome" }The blob of javascript inside
js-debug(dapDebugServer.js) already looks for@vscode/dwarf-debuggingbecause theenableDWARFflag is on by default, so you don't even need to set it in your debug config block.So now the javascript debugger can read in the debug symbols from your .wasm file and can talk to the Chrome debugger. I didn't have to do anything special to get the debug symbols in the wasm file, the project is just a simple wasm-bindgen project that I'm running with trunk via
trunk serve.This is really handy for me.
The question I have is why is this not enabled by default? Licensing? The
@vscode/dwarf-debuggingmodule is large, 53MB, but other than that, this seems like a very simple QoL addition for WASM people. Perhaps this is just a rookie mistake and there is something in the config files that I missed!Anyways, I'm really enjoying Zed so far, keep up the great work!
All reactions