summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxxabi/src/cxa_handlers.cpp19
-rw-r--r--libcxxabi/src/cxa_personality.cpp2
2 files changed, 20 insertions, 1 deletions
diff --git a/libcxxabi/src/cxa_handlers.cpp b/libcxxabi/src/cxa_handlers.cpp
index 98f7c259b51..93cc2691789 100644
--- a/libcxxabi/src/cxa_handlers.cpp
+++ b/libcxxabi/src/cxa_handlers.cpp
@@ -150,6 +150,25 @@ __attribute__((noreturn))
void
terminate() _NOEXCEPT
{
+ // If there might be an uncaught exception
+ using namespace __cxxabiv1;
+ __cxa_eh_globals* globals = __cxa_get_globals_fast();
+ if (globals)
+ {
+ __cxa_exception* exception_header = globals->caughtExceptions;
+ if (exception_header)
+ {
+ _Unwind_Exception* unwind_exception =
+ reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1;
+ bool native_exception = (unwind_exception->exception_class & get_language) ==
+ (kOurExceptionClass & get_language);
+ if (native_exception)
+ {
+ __cxa_exception* exception_header = (__cxa_exception*)(unwind_exception+1) - 1;
+ __terminate(exception_header->terminateHandler);
+ }
+ }
+ }
__terminate(get_terminate());
}
diff --git a/libcxxabi/src/cxa_personality.cpp b/libcxxabi/src/cxa_personality.cpp
index fdf86792045..1b6f1c42ee7 100644
--- a/libcxxabi/src/cxa_personality.cpp
+++ b/libcxxabi/src/cxa_personality.cpp
@@ -840,7 +840,7 @@ __cxa_call_unexpected(void* arg)
{
_Unwind_Exception* unwind_exception = static_cast<_Unwind_Exception*>(arg);
if (unwind_exception == 0)
- call_terminate(true, unwind_exception);
+ call_terminate(false, unwind_exception);
__cxa_begin_catch(unwind_exception);
bool native_old_exception = (unwind_exception->exception_class & get_language) ==
(kOurExceptionClass & get_language);
OpenPOWER on IntegriCloud