Author: hhinnant
Date: Mon Jan 30 19:51:15 2012
New Revision: 149329
URL: http://llvm.org/viewvc/llvm-project?rev=149329&view=rev
Log:
Minor bug fix in __cxa_call_unexpected. Changed std::terminate to detect a
caught-but-unhandled exception, and choose the handler out of that if found.
Modified:
libcxxabi/trunk/src/cxa_handlers.cpp
libcxxabi/trunk/src/cxa_personality.cpp
Modified: libcxxabi/trunk/src/cxa_handlers.cpp
URL:
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_handlers.cpp?rev=149329&r1=149328&r2=149329&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_handlers.cpp (original)
+++ libcxxabi/trunk/src/cxa_handlers.cpp Mon Jan 30 19:51:15 2012
@@ -150,6 +150,25 @@
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());
}
Modified: libcxxabi/trunk/src/cxa_personality.cpp
URL:
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=149329&r1=149328&r2=149329&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_personality.cpp (original)
+++ libcxxabi/trunk/src/cxa_personality.cpp Mon Jan 30 19:51:15 2012
@@ -840,7 +840,7 @@
{
_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);
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits