This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ARM Linux EABI: unwinding through a segfault handler
- From: Matthijs van Duin <matthijsvanduin at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Andrew Haley <aph at redhat dot com>, mads_bn <madsbn at mail dot dk>, Ken Werner <ken dot werner at linaro dot org>, Daniel Jacobowitz <drow at false dot org>
- Date: Sat, 3 Oct 2015 22:41:35 +0200
- Subject: Re: ARM Linux EABI: unwinding through a segfault handler
- Authentication-results: sourceware.org; auth=none
- References: <1423003290898-1117716 dot post at n5 dot nabble dot com> <20150918094950 dot GA7303 at squirrel dot local>
A shiny revised version of my unwind-through-signal code for ARM EABI:
https://github.com/mvduin/arm-signal-unwind/
For actual unwinding it now uses sigreturn as a cleanup handler (after
diddling the ucontext to make it land right onto a call to
_Unwind_Resume), which means that all state should get properly
restored by the kernel.
Virtual unwinding still only restores core registers, but hopefully
that isn't too big a problem in practice.
A small test is included that confirms throwing exceptions out of
SEGV, checks VFP is restored properly, and that returning normally
from an async signal handler still works (my original patch accidently
broke that).
I'd finally like to take a moment to say this was hell to figure
out.... this shit is really documented nowhere properly since it
appears to be a magic blend of ARM EABI and IA64 C++ ABI (meaning
neither documentation quite applies) and I had to plow through the
innards of libgcc and libsupc++ to figure out how things *actually*
work. Argh.
Anyhow, it only took four years, but you can now throw
NullPointerExceptions on ARM. Enjoy. ;-)
Matthijs van Duin