--- a/src/eh_alloc.cpp 2007-06-03 23:51:13.000000000 +0100 +++ b/src/eh_alloc.cpp 2009-07-13 09:42:39.000000000 +0100 @@ -42,4 +42,21 @@ free( (char *)(vptr) - sizeof(__cxa_exception) ); } +#if __GNUC__ * 100 + __GNUC_MINOR__ >= 404 +extern "C" __cxa_dependent_exception* __cxa_allocate_dependent_exception() throw(){ + __cxa_dependent_exception *retval; + + retval = static_cast<__cxa_dependent_exception*>(malloc(sizeof(__cxa_dependent_exception))); + if(0 == retval){ + std::terminate(); + } + memset (retval, 0, sizeof(__cxa_dependent_exception)); + return retval ; +} + +extern "C" void __cxa_free_dependent_exception(__cxa_dependent_exception *vptr) throw(){ + free( vptr ); +} +#endif + } --- a/include/unwind-cxx.h 2009-07-13 10:01:11.000000000 +0100 +++ b/include/unwind-cxx.h 2009-07-13 10:14:08.000000000 +0100 @@ -79,6 +79,41 @@ _Unwind_Exception unwindHeader; }; +#if __GNUC__ * 100 + __GNUC_MINOR__ >= 404 +// A dependent C++ exception object consists of a wrapper around an unwind +// object header with additional C++ specific information, containing a pointer +// to a primary exception object. + +struct __cxa_dependent_exception +{ + // The primary exception this thing depends on. + void *primaryException; + + // The C++ standard has entertaining rules wrt calling set_terminate + // and set_unexpected in the middle of the exception cleanup process. + std::unexpected_handler unexpectedHandler; + std::terminate_handler terminateHandler; + + // The caught exception stack threads through here. + __cxa_exception *nextException; + + // How many nested handlers have caught this exception. A negated + // value is a signal that this object has been rethrown. + int handlerCount; + + // Cache parsed handler data from the personality routine Phase 1 + // for Phase 2 and __cxa_call_unexpected. + int handlerSwitchValue; + const unsigned char *actionRecord; + const unsigned char *languageSpecificData; + _Unwind_Ptr catchTemp; + void *adjustedPtr; + + // The generic exception header. Must be last. + _Unwind_Exception unwindHeader; +}; + +#endif // Each thread in a C++ program has access to a __cxa_eh_globals object. struct __cxa_eh_globals {