1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2025-03-31 19:42:17 +02:00

(sighandler): Print procedure-name along with address.

(Logical change 1.45)
This commit is contained in:
mostang.com!davidm 2003-02-08 10:10:59 +00:00
parent ed0fad1105
commit ea39f89528

View file

@ -95,7 +95,8 @@ static void
sighandler (int signal) sighandler (int signal)
{ {
unw_cursor_t cursor; unw_cursor_t cursor;
unw_word_t ip; char name[128], off[32];
unw_word_t ip, offset;
unw_context_t uc; unw_context_t uc;
int count = 0; int count = 0;
@ -113,8 +114,13 @@ sighandler (int signal)
do do
{ {
unw_get_reg (&cursor, UNW_REG_IP, &ip); unw_get_reg (&cursor, UNW_REG_IP, &ip);
name[0] = '\0';
off[0] = '\0';
if (unw_get_proc_name (&cursor, name, sizeof (name), &offset) == 0
&& off > 0)
snprintf (off, sizeof (off), "+0x%lx", (long) offset);
if (verbose) if (verbose)
printf ("ip = %lx\n", (long) ip); printf ("ip = %lx <%s%s>\n", (long) ip, name, off);
++count; ++count;
} }
while (unw_step (&cursor) > 0); while (unw_step (&cursor) > 0);