浏览代码

base: print full stack traces in Emscripten builds.

legacy
Sam Hocevar sam 12 年前
父节点
当前提交
ebc89d4189
共有 1 个文件被更改,包括 11 次插入4 次删除
  1. +11
    -4
      src/base/assert.cpp

+ 11
- 4
src/base/assert.cpp 查看文件

@@ -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);


正在加载...
取消
保存