I want to debug a WASM program that I built (Ex. with Emscripten, Zig, or Rust) in VS Code. I will run this program using NodeJS (not in my browser). I want to debug it. Can that be done? If so, what is necessary to enable it?
You can debug WebAssembly running on NodeJS in VS Code if it contains DWARF information. You will need to install the ms-vscode.wasm-dwarf-debugging
extension.
Full docs on the debugging WASM on NodeJS in VS Code can be found at: https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_debugging-webassembly including a list of feature caveats comparing to JavaScript debugging.
Here are the release notes that announced this: https://code.visualstudio.com/updates/v1_83#_webassembly-debugging.
Bonus notes:
For debugging on web, for Chrome, see https://goo.gle/wasm-debugging-extension and https://developer.chrome.com/docs/devtools/wasm/.
For debugging webassembly from Rust's wasm-bindgen
, see https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_debugging-webassembly.