kripken/emscripten — pull request #1635 by juj (2013-09-18 16:40:34+00:00)
Title: emscripten_log() and emscripten_get_callstack()

Add new functions emscripten_log() in emscripten.h which allows printing out log messages with callstack information, and function emscripten_get_callstack(), which allows programmatically obtaining the current callstack.

The callstack retrieval supports both symbol demangling and file+line+column in .js -> file+line+column in original .cpp mapping through source maps.

I am not completely satisfied about the current requirements that are needed to add demangling and source map support to the build. Namely:
- User C++ code needs to call __cxa_demangle itself to pin down the function from libcxxabi so that it doesn't get DCE'd. I was not yet able to automate the mechanism to add it in.
- User build architecture needs to manually add cxa_demangle.cpp to the build, along with a -I directory for libcxxabi.
- A custom shell file is used to add the source map file as a preload dependency. This requires adding two lines in the existing shell.html, I now put the whole modified shell file in the test directory.
- Source mapping does not work if executing .js in node, since the source map data is not available there.

Thoughts on what would be the best ways to simplify the above requirements?