[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] unwinding from signal handler (ARM)
From: |
Sven Neumann |
Subject: |
[Libunwind-devel] unwinding from signal handler (ARM) |
Date: |
Fri, 19 Aug 2011 14:39:51 +0200 |
Hi,
we are using libunwind for a while now to obtain backtraces for crash
reports. This on an ARM with EABI. Right now we are using a somewhat
outdated git snapshot (99e60be), but I'm currently trying to update to
1.0-rc1. I don't have much success though.
With 99e60be we had the problem that we could not unwind from a signal
handler. But that is exactly what we need to do since we want to get a
backtrace from the signal handler that is called when the application
crashes (usually signal 11). We found a workaround though, instead of
calling unw_getcontext() to get an initial unw_context_t pointer to pass
to unw_init_local(), we use the pointer that we got from the signal
handler. Here's some pseudo code for this:
struct sigaction new_action;
new_action.sa_sigaction = logCrash;
sigemptyset (&new_action.sa_mask);
new_action.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV, &new_action, NULL);
sigaction(SIGFPE, &new_action, NULL);
and in logCrash we do something along the lines of:
static void
logCrash(int sig, siginfo_t *info, void *ctx)
{
unw_init_local(&cursor, ctx);
do
{
char name[128];
unw_word_t valp;
unw_word_t offset;
unw_getcontext()
if (unw_get_reg(&cursor, UNW_REG_IP, &valp) != 0)
break;
/* log function name etc. here */
ret = unw_step (&cursor);
}
while (ret > 0);
}
This worked reasonably well giving us a nice stack trace most of the
time.
Now I've updated libunwind to 1.0-rc1 and this trick doesn't seem to
work any longer. The code appears to crash in libunwind if used as
above. I had a look at the ARM implementation and found that there is
now code that's supposed to unw_step a signal handler. So I tried
without our hack and just use unw_getcontext(). Now it doesn't crash any
longer, but it also doesn't unwind over the signal handler. All I get is
a stack trace like this:
0x4016cde0 logUnwind() from /usr/lib/libraumfeld-1.0.so.0
0x40205654 ?? from /usr/lib/libunwind.so.7
Any ideas what we could do?
Thanks,
Sven
- [Libunwind-devel] unwinding from signal handler (ARM),
Sven Neumann <=
- Re: [Libunwind-devel] unwinding from signal handler (ARM), Sven Neumann, 2011/08/19
- Re: [Libunwind-devel] unwinding from signal handler (ARM), Ken Werner, 2011/08/19
- Re: [Libunwind-devel] unwinding from signal handler (ARM), Sven Neumann, 2011/08/19
- Re: [Libunwind-devel] unwinding from signal handler (ARM), Ken Werner, 2011/08/19
- Re: [Libunwind-devel] unwinding from signal handler (ARM), Sven Neumann, 2011/08/22
- Re: [Libunwind-devel] unwinding from signal handler (i586), Sven Neumann, 2011/08/22
- Re: [Libunwind-devel] unwinding from signal handler (i586), Lassi Tuura, 2011/08/22
- Re: [Libunwind-devel] unwinding from signal handler (i586), Sven Neumann, 2011/08/22
- Re: [Libunwind-devel] unwinding from signal handler (i586), Arun Sharma, 2011/08/22
- Re: [Libunwind-devel] unwinding from signal handler (i586), Ken Werner, 2011/08/30