Description
js-debug should be able to debug WebAssembly.
There's two parts of this. The base devtools experience allows users to step into and around WebAssembly, displayed as WAT. Supporting this can be done pretty easily.
The next step is giving source-level support for debugging. The Chromium team recently made their DWARF debugger open source. While this very sadly doesn't work out of the box for Rust yet, it should eventually (we can hope), and it does support any other language that outputs DWARF symbols.
While the extension is built for integration in Chrome devtools, it looks like it's architected in a way that pretty much all the work happens in the DevToolsPluginWorker
. I think that we could package this up into an node module that the extension could consume and run in a Node worker_thread.
The downside is the the DWARF SymbolBackend includes(?) chunks from LLVM and even compressed is pretty hefty at 11MB, so we may not want to have it included in vscode by default like js-debug is. My thought is that we can have an extension that exports a known API for js-debug to consume, alongside an npm package that ships only the types in the package (or maybe I just copy the types directly into js-debug). We can try to both
require('vscode').extensions.getExtension('ms-vscode.js-debug-dwarf')
as well as require('@vscode/dwarf-debugging')
to enable pure DAP consumers to get this too. And of course we can prompt the user to install this extension when they first step into WASM code.
- Enable basic debugging with WAT
- Create a module bundling the devtools c/++ worker debugger
- Integrate the module into js-debug
- Externalize the module into an extension with suggestions