mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-03-28 17:32:18 +01:00
(sighandler): Print procedure-name along with address.
(Logical change 1.45)
This commit is contained in:
parent
ed0fad1105
commit
ea39f89528
1 changed files with 8 additions and 2 deletions
|
@ -95,7 +95,8 @@ static void
|
|||
sighandler (int signal)
|
||||
{
|
||||
unw_cursor_t cursor;
|
||||
unw_word_t ip;
|
||||
char name[128], off[32];
|
||||
unw_word_t ip, offset;
|
||||
unw_context_t uc;
|
||||
int count = 0;
|
||||
|
||||
|
@ -113,8 +114,13 @@ sighandler (int signal)
|
|||
do
|
||||
{
|
||||
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)
|
||||
printf ("ip = %lx\n", (long) ip);
|
||||
printf ("ip = %lx <%s%s>\n", (long) ip, name, off);
|
||||
++count;
|
||||
}
|
||||
while (unw_step (&cursor) > 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue