Skip to content

Commit

Permalink
Support for breakpoint debugging (#371 / EW-7264)
Browse files Browse the repository at this point in the history
This change places the InspectorService in a separate thread that
manages communication with over the websocket to the inspector.

The change also adds support for runMessageLoopOnPause() and
quitMessageLoopOnPause() to support breakpoints and debugger
break statements.

There is also refactoring of the CDP message handling code so it can
be called with or without the isolate lock held.

This requires workerd to run with the command-line flag -i to turn
on inspector support.

To try this out using samples/helloworld as an example:

1) Edit "samples/helloworld/worker.js" and add a debugger statement
   to the handle(request) method.
2) Open workerd in VSCode, select 'workerd with inspector enabled (dbg)'
   as the Run and Debug Target panel. Hit F5 to run and select
   `samples/helloworld/config.capnp` as the config to use.
3) Open devtools in Chrome using either:
   * https://devtools.devprod.cloudflare.dev/js_app?ws=localhost:9229/main
   * chrome:://inspect
4) On the command-line run, `curl http://localhost:8080/`
5) Devtools should break into the running worker.

Bug: #371
Test: manual
Test: existing internal ew tests do not break
  • Loading branch information
ohodson committed Jun 30, 2023
1 parent 42bcb24 commit af925c7
Show file tree
Hide file tree
Showing 4 changed files with 533 additions and 304 deletions.
Loading

0 comments on commit af925c7

Please sign in to comment.