emmatyping / python-wasm

Build scripts and configuration for building CPython for Emscripten
https://repl.ethanhs.me
679 stars 35 forks source link

Debugging Emscripten builds #40

Open tiran opened 2 years ago

tiran commented 2 years ago

It's tricky to debug emscripten builds. By default emcc strips all debug symbols and even function names from WASM files. I got some promising results with debug builds, source map, and Chromium DevTools.

Screenshot_20220105_171125

tiran commented 2 years ago

Source map does not require a debug build. A standard build of Python includes sufficient DWARF symbols to generate a source map:

$ emmake make python.html BUILDPYTHON= LDFLAGS="-gsource-map --source-map-base=http://localhost:8000/builddir/host/"