summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Root <root@xlocale.(none)>2011-09-20 14:09:36 +0100
committerCharlie Root <root@xlocale.(none)>2011-09-20 14:09:36 +0100
commitd05b021ced29ae0ce32a5801db33b5343790b5c9 (patch)
treeccd3fe721c8c07a1880fcd48770242fb450f8c44
parent93a59224201fc233ac208f94b61149ff95e4a4ba (diff)
downloadlibcxxrt-d05b021ced29ae0ce32a5801db33b5343790b5c9.tar.gz
libcxxrt-d05b021ced29ae0ce32a5801db33b5343790b5c9.tar.bz2
libcxxrt-d05b021ced29ae0ce32a5801db33b5343790b5c9.tar.xz
Add get_terminate() / get_unexpected() functions required by libc++.
Fixed the default unexpected handler to std::terminate().
-rw-r--r--src/exception.cc28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/exception.cc b/src/exception.cc
index ec9d4f0..97e014d 100644
--- a/src/exception.cc
+++ b/src/exception.cc
@@ -183,7 +183,7 @@ using namespace ABI_NAMESPACE;
/** The global termination handler. */
static terminate_handler terminateHandler = abort;
/** The global unexpected exception handler. */
-static unexpected_handler unexpectedHandler = abort;
+static unexpected_handler unexpectedHandler = std::terminate;
/** Key used for thread-local data. */
static pthread_key_t eh_key;
@@ -1223,6 +1223,7 @@ namespace std
*/
void terminate()
{
+ fprintf(stderr, "Terminate called\n");
static __cxa_thread_info *info = thread_info_fast();
if (0 != info && 0 != info->terminateHandler)
{
@@ -1259,5 +1260,28 @@ namespace std
__cxa_thread_info *info = thread_info();
return info->globals.uncaughtExceptions != 0;
}
-
+ /**
+ * Returns the current unexpected handler.
+ */
+ unexpected_handler get_unexpected() throw()
+ {
+ __cxa_thread_info *info = thread_info();
+ if (info->unexpectedHandler)
+ {
+ return info->unexpectedHandler;
+ }
+ return unexpectedHandler;
+ }
+ /**
+ * Returns the current terminate handler.
+ */
+ terminate_handler get_terminate() throw()
+ {
+ __cxa_thread_info *info = thread_info();
+ if (info->terminateHandler)
+ {
+ return info->terminateHandler;
+ }
+ return terminateHandler;
+ }
}