mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-02-17 02:31:41 +01:00
(do_backtrace): Replace reading of UNW_REG_PROC_START, UNW_REG_HANDLER, and
UNW_REG_LSDA with call to unw_get_proc_info(). (Logical change 1.29)
This commit is contained in:
parent
3ab317eef5
commit
15eec54cc8
1 changed files with 12 additions and 6 deletions
18
tests/bt.c
18
tests/bt.c
|
@ -41,6 +41,7 @@ do_backtrace (void)
|
||||||
unw_cursor_t cursor;
|
unw_cursor_t cursor;
|
||||||
unw_word_t ip, sp;
|
unw_word_t ip, sp;
|
||||||
unw_context_t uc;
|
unw_context_t uc;
|
||||||
|
int ret;
|
||||||
|
|
||||||
unw_getcontext (&uc);
|
unw_getcontext (&uc);
|
||||||
if (unw_init_local (&cursor, &uc) < 0)
|
if (unw_init_local (&cursor, &uc) < 0)
|
||||||
|
@ -53,17 +54,22 @@ do_backtrace (void)
|
||||||
printf ("ip=%016lx sp=%016lx\n", ip, sp);
|
printf ("ip=%016lx sp=%016lx\n", ip, sp);
|
||||||
|
|
||||||
{
|
{
|
||||||
unw_word_t proc_start, handler, lsda, bsp;
|
unw_proc_info_t pi;
|
||||||
|
unw_word_t bsp;
|
||||||
|
|
||||||
unw_get_reg (&cursor, UNW_REG_PROC_START, &proc_start);
|
unw_get_proc_info (&cursor, &pi);
|
||||||
unw_get_reg (&cursor, UNW_REG_HANDLER, &handler);
|
|
||||||
unw_get_reg (&cursor, UNW_REG_LSDA, &lsda);
|
|
||||||
unw_get_reg (&cursor, UNW_IA64_BSP, &bsp);
|
unw_get_reg (&cursor, UNW_IA64_BSP, &bsp);
|
||||||
printf ("\tproc_start=%016lx handler=%lx lsda=%lx bsp=%lx\n",
|
printf ("\tproc_start=%016lx handler=%lx lsda=%lx bsp=%lx\n",
|
||||||
proc_start, handler, lsda, bsp);
|
pi.start_ip, pi.end_ip, pi.lsda, bsp);
|
||||||
}
|
}
|
||||||
|
ret = unw_step (&cursor);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
unw_get_reg (&cursor, UNW_REG_IP, &ip);
|
||||||
|
printf ("FAILURE: unw_step() returned %d for ip=%lx\n", ret, ip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (unw_step (&cursor) > 0);
|
while (ret > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Reference in a new issue