diff options
author | Charlie Root <root@xlocale.(none)> | 2011-09-20 14:09:36 +0100 |
---|---|---|
committer | Charlie Root <root@xlocale.(none)> | 2011-09-20 14:09:36 +0100 |
commit | d05b021ced29ae0ce32a5801db33b5343790b5c9 (patch) | |
tree | ccd3fe721c8c07a1880fcd48770242fb450f8c44 /src | |
parent | 93a59224201fc233ac208f94b61149ff95e4a4ba (diff) | |
download | libcxxrt-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().
Diffstat (limited to 'src')
-rw-r--r-- | src/exception.cc | 28 |
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; + } } |