| @@ -8,17 +8,21 @@ | |||||
| // http://www.wtfpl.net/ for more details. | // http://www.wtfpl.net/ for more details. | ||||
| // | // | ||||
| #if defined HAVE_CONFIG_H | |||||
| #if HAVE_CONFIG_H | |||||
| # include "config.h" | # include "config.h" | ||||
| #endif | #endif | ||||
| #if defined HAVE_CXXABI_H | |||||
| #if HAVE_CXXABI_H | |||||
| # include <cxxabi.h> | # include <cxxabi.h> | ||||
| #endif | #endif | ||||
| #if defined HAVE_EXECINFO_H | |||||
| #if HAVE_EXECINFO_H | |||||
| # include <execinfo.h> | # include <execinfo.h> | ||||
| #endif | #endif | ||||
| #if EMSCRIPTEN | |||||
| # include <emscripten.h> | |||||
| #endif | |||||
| #include "core.h" | #include "core.h" | ||||
| namespace lol | namespace lol | ||||
| @@ -26,7 +30,10 @@ namespace lol | |||||
| void DumpStack() | 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 */ | /* Get current stack frames */ | ||||
| void *stack_ptrs[50]; | void *stack_ptrs[50]; | ||||
| size_t size = backtrace(stack_ptrs, 50); | size_t size = backtrace(stack_ptrs, 50); | ||||