Playground: Emscripten debugging infrastructure (DWARF, source maps, debug dumps) #238

Open
opened 2026-02-02 20:51:12 +00:00 by john · 0 comments
Owner

Overview

Add comprehensive debugging infrastructure for the Emscripten/WASM builds to help developers troubleshoot issues in the playground and standalone game deployments.

Scope

Build Configuration

  • Add CMake options for debug WASM builds with DWARF symbols
  • Configure -gsource-map and --emit-symbol-map for source mapping
  • Add -sASSERTIONS=2 -sSAFE_HEAP=1 -sSTACK_OVERFLOW_CHECK=2 for debug builds
  • Keep -g2 for release builds (minimal debug info for stack traces)

Console Debug Functions

Expose C++ functions callable from browser console:

EMSCRIPTEN_KEEPALIVE void dump_python_globals();    // Print all Python globals
EMSCRIPTEN_KEEPALIVE void dump_loaded_modules();    // List loaded Python modules

With JavaScript wrappers:

window.dumpPythonGlobals();
window.dumpLoadedModules();

Documentation

  • Document Chrome DWARF extension installation
  • Explain how to use DevTools Sources panel with C++ source mapping
  • Add debug build instructions to CLAUDE.md

References

Part of playground improvement initiative documented in docs/PLAYGROUND_IMPROVEMENT_PLAN.md (Phase 3)

## Overview Add comprehensive debugging infrastructure for the Emscripten/WASM builds to help developers troubleshoot issues in the playground and standalone game deployments. ## Scope ### Build Configuration - Add CMake options for debug WASM builds with DWARF symbols - Configure `-gsource-map` and `--emit-symbol-map` for source mapping - Add `-sASSERTIONS=2 -sSAFE_HEAP=1 -sSTACK_OVERFLOW_CHECK=2` for debug builds - Keep `-g2` for release builds (minimal debug info for stack traces) ### Console Debug Functions Expose C++ functions callable from browser console: ```cpp EMSCRIPTEN_KEEPALIVE void dump_python_globals(); // Print all Python globals EMSCRIPTEN_KEEPALIVE void dump_loaded_modules(); // List loaded Python modules ``` With JavaScript wrappers: ```javascript window.dumpPythonGlobals(); window.dumpLoadedModules(); ``` ### Documentation - Document Chrome DWARF extension installation - Explain how to use DevTools Sources panel with C++ source mapping - Add debug build instructions to CLAUDE.md ## References - [Emscripten Debugging Documentation](https://emscripten.org/docs/porting/Debugging.html) - [Chrome WASM Debugging](https://developer.chrome.com/docs/devtools/wasm) - [DWARF Chrome Extension](https://developer.chrome.com/blog/wasm-debugging-2020) ## Related Part of playground improvement initiative documented in `docs/PLAYGROUND_IMPROVEMENT_PLAN.md` (Phase 3)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#238
No description provided.