+ ::_SysDebug("__cxa_free_exception(%p)", thrown_exception);
+ if(thrown_exception == &emergency_exception.buf) {
+ //assert(emergency_exception_used);
+ emergency_exception_used = false;
+ }
+ else {
+ __cxa_exception *except = static_cast<__cxa_exception*>( thrown_exception ) - 1;
+ free(except);
+ }
+}
+
+extern "C" void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void (*dest)(void*))
+{
+ ::_SysDebug("__cxa_throw(%p,%p,%p) '%s' by %p",
+ thrown_exception, tinfo, dest, tinfo->name(), __builtin_return_address(0)
+ );
+ {
+ const ::std::exception* e = reinterpret_cast<const ::std::exception*>(thrown_exception);
+ ::_SysDebug("- e.what() = '%s'", e->what());
+ }
+
+ __cxa_exception *except = static_cast<__cxa_exception*>( thrown_exception ) - 1;
+
+ except->unexpectedHandler = 0;
+ except->terminateHandler = 0;
+ except->exceptionType = tinfo;
+ except->exceptionDestructor = dest;
+ memcpy(&except->unwindHeader.exception_class, EXCEPTION_CLASS_ACESS, 8);
+ __cxa_get_globals()->uncaughtExceptions ++;
+
+ int rv = _Unwind_RaiseException( &except->unwindHeader );
+
+ ::_SysDebug("__cxa_throw(%p,%s) :: UNCAUGHT %i", thrown_exception, tinfo->name(), rv);
+ ::std::terminate();
+}
+
+extern "C" void *__cxa_begin_catch(_Unwind_Exception *exceptionObject)
+{
+ __cxa_exception *except = reinterpret_cast<__cxa_exception*>( exceptionObject+1 )-1;
+ ::_SysDebug("__cxa_begin_catch(%p) - except=%p", exceptionObject, except);