Skip to content

Debugging WASM code

Marc Durdin edited this page Mar 10, 2023 · 2 revisions

Very quick notes on using Chrome Dev Tools + NodeJS to debug wasm versions of Core and kmcmplib:

  1. Do a debug build (see #8393 for how debug builds can be setup to support debugging)
  2. Install C/C++ DevTools Support (DWARF) Chrome extension, per https://developer.chrome.com/blog/wasm-debugging-2020/
  3. Run node --enable-sourcemaps --inspect-brk <cmdline>
  4. In Chrome, open chrome://inspect, then open the node inspector when it is listed.
  5. In order to set breakpoints in the C++ code, you will need to break on the C++ main() entry point in the js bootloader. The location of this can vary so YMMV, but look for main.

Then, it "should just work".

Refs:

Clone this wiki locally