fixed the stack frame dump function.
fixed a fault in configure.ac
This commit is contained in:
parent
2218e61faa
commit
216e7f3b15
2
moo/configure
vendored
2
moo/configure
vendored
@ -21530,7 +21530,7 @@ fi
|
||||
|
||||
if test "x${enable_libunwind_is}" = "xyes"
|
||||
then
|
||||
if test "x${ac_cv_header_unwind_h}" = "xyes" -a "${UNWIND_LIBS}" != ""
|
||||
if test "x${ac_cv_header_libunwind_h}" = "xyes" -a "${UNWIND_LIBS}" != ""
|
||||
then
|
||||
|
||||
$as_echo "#define MOO_ENABLE_LIBUNWIND /**/" >>confdefs.h
|
||||
|
@ -745,7 +745,7 @@ AC_ARG_ENABLE([libunwind],
|
||||
)
|
||||
if test "x${enable_libunwind_is}" = "xyes"
|
||||
then
|
||||
if test "x${ac_cv_header_unwind_h}" = "xyes" -a "${UNWIND_LIBS}" != ""
|
||||
if test "x${ac_cv_header_libunwind_h}" = "xyes" -a "${UNWIND_LIBS}" != ""
|
||||
then
|
||||
AC_DEFINE([MOO_ENABLE_LIBUNWIND],[],[use libunwind for backtracing stack frames])
|
||||
else
|
||||
|
@ -476,28 +476,28 @@ static void backtrace_stack_frames (moo_t* moo)
|
||||
{
|
||||
unw_cursor_t cursor;
|
||||
unw_context_t context;
|
||||
int n;
|
||||
|
||||
unw_getcontext(&context);
|
||||
unw_init_local(&cursor, &context);
|
||||
|
||||
int n=0;
|
||||
while (unw_step(&cursor))
|
||||
moo_logbfmt (moo, MOO_LOG_UNTYPED | MOO_LOG_DEBUG, "[BACKTRACE]\n");
|
||||
for (n = 0; unw_step(&cursor) > 0; n++)
|
||||
{
|
||||
unw_word_t ip, sp, off;
|
||||
char symbol[256];
|
||||
|
||||
unw_get_reg (&cursor, UNW_REG_IP, &ip);
|
||||
unw_get_reg (&cursor, UNW_REG_SP, &sp);
|
||||
|
||||
char symbol[256];
|
||||
|
||||
if (!unw_get_proc_name(&cursor, symbol, MOO_COUNTOF(symbol), &off))
|
||||
if (unw_get_proc_name(&cursor, symbol, MOO_COUNTOF(symbol), &off))
|
||||
{
|
||||
moo_copy_bcstr (symbol, "<unknown>");
|
||||
moo_copy_bcstr (symbol, MOO_COUNTOF(symbol), "<unknown>");
|
||||
}
|
||||
|
||||
moo_logbfmt (moo, MOO_LOG_UNTYPED | MOO_LOG_DEBUG,
|
||||
"#%-2d 0x%016p p=0x%016p %s + 0x%zu\n",
|
||||
++n, (void*)ip, (void*)sp, symbol, (moo_oow_t)off);
|
||||
"#%02d ip=0x%*p sp=0x%*p %s+0x%zu\n",
|
||||
n, MOO_SIZEOF(void*) * 2, (void*)ip, MOO_SIZEOF(void*) * 2, (void*)sp, symbol, (moo_oow_t)off);
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_BACKTRACE)
|
||||
|
Loading…
Reference in New Issue
Block a user