diff --git a/src/base/assert.cpp b/src/base/assert.cpp index 1907b49f..27827b45 100644 --- a/src/base/assert.cpp +++ b/src/base/assert.cpp @@ -8,17 +8,21 @@ // http://www.wtfpl.net/ for more details. // -#if defined HAVE_CONFIG_H +#if HAVE_CONFIG_H # include "config.h" #endif -#if defined HAVE_CXXABI_H +#if HAVE_CXXABI_H # include #endif -#if defined HAVE_EXECINFO_H +#if HAVE_EXECINFO_H # include #endif +#if EMSCRIPTEN +# include +#endif + #include "core.h" namespace lol @@ -26,7 +30,10 @@ namespace lol void DumpStack() { -#if defined HAVE_CXA_DEMANGLE && defined HAVE_BACKTRACE_SYMBOLS +#if EMSCRIPTEN + /* This would require demangling but we don't care yet. */ + Log::Debug("%s\n", emscripten_run_script_string("(new Error).stack")); +#elif HAVE_CXA_DEMANGLE && HAVE_BACKTRACE_SYMBOLS /* Get current stack frames */ void *stack_ptrs[50]; size_t size = backtrace(stack_ptrs, 50);