Signal handlers and _Unwind_IsSignalFrame
Tue Sep 9 13:37:00 GMT 2008
I have a problem. I want to handle signals like SIGSEGV in non-main
threads of C++ program and terminate thread by pthread_exit call. Of
course I need all destructors of objects on stack to be called (eg.
When compiling with -fnon-call-exceptios everything almost works but:
In context is saved address of failing instruction, not adress of
instruction after the failing one. Thus decrementing of this address in
__gxx_personality_v0 sometimes leads to calling of terminate(), because
no suitable entry in call-site table (?is it the right name?) is found
It is clearly supposed to be handled by SIGNAL_FRAME_BIT in flagss in
struct _Unwind_Context. But this bit is not set in my context. That is
why __gxx_personality misses proper handler by one byte, and calls
terminate instead. If I put one simple pointer dereference before my
failing instruction, decremented address is now inside the range
described in call-site table and everything works fine.
I am not sure I understand well how the SIGNAL_FRAME_BIT flag is
supposed to be set. Shall there be a CIE with "S" augmentation
in .eh_frame for signal handler? Threre is not such one in my program.
How can I make gcc to create one? Or am I completely wrong?
Just for completenes I have tried with gcc 4.1.0 and 4.2.1 on x86_64
(Suse 10.1 and 10.3).
Thanks in advance
More information about the Gcc-help