cpptrace
cpptrace copied to clipboard
Feature Request: Emscripten support
Would be nice to get even (partial) support for Emscripten -- I currently only need cpptrace::generate_trace().print() in my project, and I have to #ifdef for Emscripten like this:
#ifdef SFML_SYSTEM_EMSCRIPTEN
char callstack[4096];
emscripten_get_callstack(EM_LOG_C_STACK, callstack, sizeof(callstack));
std::puts(callstack);
#else
cpptrace::generate_trace().print();
#endif
Would be nice if cpptrace handled this automatically :)
I've started looking into adding support for this. The main issue would be parsing the result from emscripten_get_callstack and I don't have as much confidence in doing this as I'd like. It seems the format can differ depending on where the js/wasm is being ran. Do you have any advice?
Unfortunately I do not have any experience with that, the only pointer I can provide is the function that generates the callstack in Emscripten: https://github.com/emscripten-core/emscripten/blob/e6ed9d3fc2821a72cc8ded4a02cac72b9f306f88/src/library_stack_trace.js#L12-L97
It seems it already does some normalization between browsers