[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libunwind-devel] SIGFPE and _Unwind_GetIPInfo problem on x86_64 (g+
From: |
Arun Sharma |
Subject: |
Re: [Libunwind-devel] SIGFPE and _Unwind_GetIPInfo problem on x86_64 (g++-4.5) |
Date: |
Mon, 7 Feb 2011 18:53:45 -0800 |
On Sat, Feb 5, 2011 at 5:26 PM, address@hidden
<address@hidden> wrote:
> Hi,
>
> I've experimented somewhat with throwing exceptions from within a signal
> handler.
> Libunwind seems to work in the case of SIGILL, SIGBUS, SIGSEGV, but not
> always for SIGFPE.
Processor exceptions come in two flavors:
* fault: the IP points to the instruction that caused the exception
* trap: the IP points to the instruction after the one that caused it.
I suspect that the i386 and arm differ in how they deal with division
by zero. I'm not very familiar with ARM, but docs such as:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472c/BABDFCBA.html
suggest that it's a trap on ARM. It's a fault on x86.
(gdb) r
Starting program: /tmp/sigfpe_ip
Program received signal SIGFPE, Arithmetic exception.
0x0000000000400a72 in fpe() ()
(gdb) x /i $rip
=> 0x400a72 <_Z3fpev+28>: idivl -0x24(%rbp)
It's possible that libunwind is not doing the right thing here:
src/unwind/GetIPInfo.c:
*ip_before_insn = unw_is_signal_frame (&context->cursor);
I can't seem to find any information about the GetIPInfo interface here:
http://www.codesourcery.com/public/cxx-abi/
But I suspect a correct implementation would have to be arch specific
and understand which exceptions are faults vs traps.
I'm also Cc'ing Jan Kratochvil who contributed this code originally
for comments. There was a ia64 specific implementation of this
interface that was later removed. You're welcome to contribute a patch
with ARM specific implementation.
-Arun
Re: [Libunwind-devel] SIGFPE and _Unwind_GetIPInfo problem on x86_64 (g++-4.5),
Arun Sharma <=