// // Called by __cxa_rethrow() // EXPORT _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception* exception_object) { DEBUG_PRINT_API("__Unwind_SjLj_Resume_or_Rethrow(ex_obj=%p), private_1=%ld\n", exception_object, exception_object->private_1); // if this is non-forced and a stopping place was found, then this is a re-throw // call _Unwind_RaiseException() as if this was a new exception if ( exception_object->private_1 == 0 ) _Unwind_SjLj_RaiseException(exception_object); // call through to _Unwind_Resume() which distiguishes between forced and regular exceptions _Unwind_SjLj_Resume(exception_object); ABORT("__Unwind_SjLj_Resume_or_Rethrow() called _Unwind_SjLj_Resume() which unexpectedly returned"); }
void objc_exception_throw (id value) { struct ObjcException *header = calloc (1, sizeof (*header)); __OBJC_INIT_EXCEPTION_CLASS(header->base.exception_class); header->base.exception_cleanup = __objc_exception_cleanup; header->value = value; #ifdef SJLJ_EXCEPTIONS _Unwind_SjLj_RaiseException (&header->base); #else _Unwind_RaiseException (&header->base); #endif /* Some sort of unwinding error. */ abort (); }
/// Called by __cxa_rethrow(). _LIBUNWIND_EXPORT _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *exception_object) { _LIBUNWIND_TRACE_API("__Unwind_SjLj_Resume_or_Rethrow(ex_obj=%p), " "private_1=%ld\n", exception_object, exception_object->private_1); // If this is non-forced and a stopping place was found, then this is a // re-throw. // Call _Unwind_RaiseException() as if this was a new exception. if (exception_object->private_1 == 0) { return _Unwind_SjLj_RaiseException(exception_object); // should return if there is no catch clause, so that __cxa_rethrow can call // std::terminate() } // Call through to _Unwind_Resume() which distiguishes between forced and // regular exceptions. _Unwind_SjLj_Resume(exception_object); _LIBUNWIND_ABORT("__Unwind_SjLj_Resume_or_Rethrow() called " "_Unwind_SjLj_Resume() which unexpectedly returned"); }
/* This routine can rethrow native or foreign exceptions. If the exception is native: * marks the exception object on top of the caughtExceptions stack (in an implementation-defined way) as being rethrown. * If the caughtExceptions stack is empty, it calls terminate() (see [C++FDIS] [except.throw], 15.1.8). * It then calls _Unwind_RaiseException which should not return (terminate if it does). Note: exception_header may be masquerading as a __cxa_dependent_exception and that's ok. */ LIBCXXABI_NORETURN void __cxa_rethrow() { __cxa_eh_globals* globals = __cxa_get_globals(); __cxa_exception* exception_header = globals->caughtExceptions; if (NULL == exception_header) std::terminate(); // throw; called outside of a exception handler bool native_exception = isOurExceptionClass(&exception_header->unwindHeader); if (native_exception) { // Mark the exception as being rethrown (reverse the effects of __cxa_begin_catch) exception_header->handlerCount = -exception_header->handlerCount; globals->uncaughtExceptions += 1; // __cxa_end_catch will remove this exception from the caughtExceptions stack if necessary } else // this is a foreign exception { // The only way to communicate to __cxa_end_catch that we've rethrown // a foreign exception, so don't delete us, is to pop the stack here // which must be empty afterwards. Then __cxa_end_catch will do // nothing globals->caughtExceptions = 0; } #if __arm__ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); #else _Unwind_RaiseException(&exception_header->unwindHeader); #endif // If we get here, some kind of unwinding error has occurred. // There is some weird code generation bug happening with // Apple clang version 4.0 (tags/Apple/clang-418.0.2) (based on LLVM 3.1svn) // If we call failed_throw here. Turns up with -O2 or higher, and -Os. __cxa_begin_catch(&exception_header->unwindHeader); if (native_exception) std::__terminate(exception_header->terminateHandler); // Foreign exception: can't get exception_header->terminateHandler std::terminate(); }
void __go_unwind_stack () { struct _Unwind_Exception *hdr; hdr = ((struct _Unwind_Exception *) __go_alloc (sizeof (struct _Unwind_Exception))); __builtin_memcpy (&hdr->exception_class, &__go_exception_class, sizeof hdr->exception_class); hdr->exception_cleanup = NULL; runtime_g ()->exception = hdr; #ifdef __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException (hdr); #else _Unwind_RaiseException (hdr); #endif /* Raising an exception should not return. */ abort (); }
void objc_exception_throw (id value) { struct ObjcException *header = calloc (1, sizeof (*header)); memcpy (&header->base.exception_class, &__objc_exception_class, sizeof (__objc_exception_class)); header->base.exception_cleanup = __objc_exception_cleanup; header->value = value; #ifdef SJLJ_EXCEPTIONS _Unwind_SjLj_RaiseException (&header->base); #else _Unwind_RaiseException (&header->base); #endif /* Some sort of unwinding error. */ if (_objc_unexpected_exception != 0) { (*_objc_unexpected_exception) (value); } abort (); }
_Unwind_Reason_Code __gnat_Unwind_RaiseException (_Unwind_Exception *e) { return _Unwind_SjLj_RaiseException (e); }