aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvsukharev <vladimir.sukharev@gmail.com>2014-05-09 01:35:39 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-09 01:35:39 +0000
commit6ec9b35c6a51bfe849981888cc68d16a1a15062c (patch)
tree62ce5ae97101409f6c29be130c2ef800a420f260
parent1a363fb6e4d6e0381b387cef48b27e105af5c34e (diff)
parent535027e476b6e6b5cd214e3fe81f7c2e884f98d7 (diff)
downloadlibcxxrt-6ec9b35c6a51bfe849981888cc68d16a1a15062c.tar.gz
am 535027e4: Uncaught exception could not be rethrown. Fix of CCVS/Sec15/1/P15144.C
* commit '535027e476b6e6b5cd214e3fe81f7c2e884f98d7': Uncaught exception could not be rethrown. Fix of CCVS/Sec15/1/P15144.C
-rw-r--r--src/exception.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/exception.cc b/src/exception.cc
index 736c65b..edd99ae 100644
--- a/src/exception.cc
+++ b/src/exception.cc
@@ -673,6 +673,11 @@ static _Unwind_Reason_Code trace(struct _Unwind_Context *context, void *c)
* If the failure happened by falling off the end of the stack without finding
* a handler, prints a back trace before aborting.
*/
+#if __GNUC__ > 3 && __GNUC_MINOR__ > 2
+extern "C" void *__cxa_begin_catch(void *e) throw();
+#else
+extern "C" void *__cxa_begin_catch(void *e);
+#endif
static void report_failure(_Unwind_Reason_Code err, __cxa_exception *thrown_exception)
{
switch (err)
@@ -687,6 +692,8 @@ static void report_failure(_Unwind_Reason_Code err, __cxa_exception *thrown_exce
break;
#endif
case _URC_END_OF_STACK:
+ __cxa_begin_catch (&(thrown_exception->unwindHeader));
+ std::terminate();
fprintf(stderr, "Terminating due to uncaught exception %p",
static_cast<void*>(thrown_exception));
thrown_exception = realExceptionFromException(thrown_exception);
@@ -716,6 +723,9 @@ static void report_failure(_Unwind_Reason_Code err, __cxa_exception *thrown_exce
// Print a back trace if no handler is found.
// TODO: Make this optional
_Unwind_Backtrace(trace, 0);
+
+ // Just abort. No need to call std::terminate for the second time
+ abort();
break;
}
std::terminate();