42 unw_cursor_t cursor = { 0 };
43 unw_context_t uc = { 0 };
46 char buf[256] = { 0 };
49 printf(
"Backtrace\n");
52 unw_init_local(&cursor, &uc);
53 while (unw_step(&cursor) > 0)
55 unw_get_reg(&cursor, UNW_REG_IP, &ip);
56 unw_get_reg(&cursor, UNW_REG_SP, &sp);
57 unw_get_proc_name(&cursor, buf,
sizeof(buf), &ip);
60 printf(
" %s() ip = %lx, sp = %lx\n", buf, (
long) ip, (
long) sp);