Search code examples
node.jsvisual-studio-codewebassemblyvscode-debugger

How can I debug WebAssembly running on NodeJS in VS Code?


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?


Solution

  • 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: