Skip to content

WASM debugging support #1789

Closed
Closed

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.

  1. Enable basic debugging with WAT
  2. Create a module bundling the devtools c/++ worker debugger
  3. Integrate the module into js-debug
  4. Externalize the module into an extension with suggestions

Activity

  1. added
    feature-request
    on Aug 24, 2023
  2. connor4312 commented on Sep 19, 2023

    @connor4312
    MemberAuthor

    This is largely done now in PRs #1804 through #1808. Tomorrow I will do some final cleanup and try to get some tests going, and then it will ship in the nightly.

  3. added 2 commits that reference this issue on Sep 20, 2023
    ae8c0fa
    f60e5ac
  4. added a commit that references this issue on Sep 20, 2023
    7b40f5c
  5. fleabitten232 commented on Sep 25, 2023

    @fleabitten232

    Does this currently support the "path substitution" feature from the Chrome plugin? I compile in a container, which means that the source file paths are incorrect for the machine I want to debug on.

    Appreciate all the work that's been done on this and I'm eager to try it out!

  6. connor4312 commented on Sep 25, 2023

    @connor4312
    MemberAuthor

    The path goes through the usual path mapping logic in js-debug, so for your case you'd want to set the localRoot/remoteRoot in your launch.json as described in https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_remote-debugging

  7. added
    on-testplan
    on Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requeston-testplan

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions