This is the mail archive of the
mailing list for the GCC project.
Re: How to benefit from asynchronous unwind tables?
- From: David Daney <ddaney at caviumnetworks dot com>
- To: Ewgenij Gawrilow <ewgenij dot gawrilow at o2online dot de>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 16 Oct 2009 11:13:47 -0700
- Subject: Re: How to benefit from asynchronous unwind tables?
- References: <4AD8B57E.firstname.lastname@example.org>
Ewgenij Gawrilow wrote:
is somebody out there who has consciously used the asynchronous unwind
tables? The GCC documentation does not reveal much more about this
feature than the mere statement of its existence.
What I eventually need is the possibility to catch certain signals and
unwind a part of the stack down to a certain frame in a mixed C / C++
A naive approach of throwing an exception from the signal handler does
not work, neither does a siglongjump from the handler unwind the stack
frames between it and the frame where sigsetjump was executed (although
some C++ ABI drafts suggested this behaviour).
The main problem is probably the kernel-generated frame of the signal
handler, lying between the frame where unwinding starts and the catching
frame. If I set up the signal handler to use the alternative stack,
this frame won't be an obstacle any more; but I didn't find any clue how
to tell the unwinding machinery (_Unwind_RaiseException and the
relatives) as it is implemented in libgcc, that it has to scan over a
I'd deeply appreciate any helpful advice and tips. The solution needn't
be universally portable; I'll be overly glad to get it running under
Linux on i386 and x86_64, and in the further future, if possible, under
libgcj (GCC's java runtime library) does exactly what you describe for
synchronous signals (SIGSEGV, SIGFPE). Throwing exceptions through such
signal frames does work for both i386 and x86_64 (as well as many other
architectures) on linux. Unwinding from arbitrary asynchronous signals
(SIGUSR1 etc.) is not supported.
The code that does it can be found in libjava/prims.cc