SYSV Unwind ABI - foreign-exception + catch-all block
Oliver Kowalke
oliver.kowalke@gmail.com
Tue Apr 9 15:18:00 GMT 2019
Hi,
in dacument `AMD64 ABI Draft 0.99.4 – January 13, 2010` contains following:
"A catch-all block may be executed during forced unwinding. For instance, a
longjmp may execute code in a catch(...) during stack unwinding.However,if
this happens, unwinding will proceed at the end of the catch-all block,
whether or not there is an explicit re-throw."
Using lon gjmp/setjmp and calling _Unwind_ForcedUnwind() with an
foreign-exception:
const _Unwind_Exception_Class __gxx_fiber_exception_class
= ((((((((_Unwind_Exception_Class) 'G'
<< 8 | (_Unwind_Exception_Class) 'N')
<< 8 | (_Unwind_Exception_Class) 'U')
<< 8 | (_Unwind_Exception_Class) 'F')
<< 8 | (_Unwind_Exception_Class) 'I')
<< 8 | (_Unwind_Exception_Class) 'B')
<< 8 | (_Unwind_Exception_Class) 'E')
<< 8 | (_Unwind_Exception_Class) 'R');
#define __GXX_INIT_FIBER_EXCEPTION_CLASS(c) c = __gxx_fiber_exception_class
_Unwind_Exception * exc = new _Unwind_Exception{};
std::memset( exc, 0, sizeof( * exc) );
__GXX_INIT_FIBER_EXCEPTION_CLASS(exc->exception_class);
exc->exception_cleanup = fiber_exception_cleanup;
_Unwind_ForcedUnwind( exc, stop_unwinding< Ctx >, t.fctx);
I would expect that a catch-all block in the call chain is entered but
after leavin teh catch-all block the unwinding proceeds.
Unfortunately this doesn't happen - gcc/libstdc++-v3 8.2.1.
Is this a bug or does a reason exists why unwinding the stack should not
proceed?
Which functions do need to be fixed in order to implement the requirement
of proceeding the unwinding as described in the specification (I guess
__cxa_end_catch())?
ty,
Oliver
More information about the Libstdc++
mailing list