Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging Emscripten builds #40

Open
tiran opened this issue Jan 5, 2022 · 1 comment
Open

Debugging Emscripten builds #40

tiran opened this issue Jan 5, 2022 · 1 comment

Comments

@tiran
Copy link
Collaborator

tiran commented Jan 5, 2022

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.

  • Configure with --with-pydebug
  • Extend PY_LDFLAGS_NODIST var with -gsource-map --source-map-base http://localhost:8000/builddir/host/
  • emmake make -j8 python.html
  • Run python3 -m http.server from the cpython base directory (not the directory where python.html lives).
  • open http://localhost:8000/builddir/host/python.html
  • Use Chromium with C/C++ DevTools Support (DWARF) support and WebAssembly Debugging: Enable DWARF support.

Screenshot_20220105_171125

@tiran
Copy link
Collaborator Author

tiran commented Jan 5, 2022

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/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant