diff options
author | Howard Hinnant <hhinnant@apple.com> | 2012-01-30 16:07:00 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2012-01-30 16:07:00 +0000 |
commit | 7da9b96afc66c4496eb8809897c1b707b574a5c4 (patch) | |
tree | 06a075d4f2c6aab26fefe7d5b18f38693d8e50ae /src/cxa_handlers.cpp | |
parent | 2b891bfd06e8e1ecf399b2684d5616de507e8403 (diff) |
Add a descriptive name for a constant. Also I'm at least temporarily waging war on throw specs, both old and new style. Except where we have already publicly exposed the throw spec, I'm getting rid of them. They may come back later. But they seem somewhat prone to cyclic dependencies here. The throw spec implies compiler generated code that this library has to jump to during stack unwinding. I'd like to minimize the possiblity that the code used to properly make that jump is itself creating such jumps.
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@149251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/cxa_handlers.cpp')
-rw-r--r-- | src/cxa_handlers.cpp | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/cxa_handlers.cpp b/src/cxa_handlers.cpp index 15fde24..98f7c25 100644 --- a/src/cxa_handlers.cpp +++ b/src/cxa_handlers.cpp @@ -37,24 +37,34 @@ static void default_terminate_handler() { _Unwind_Exception* unwind_exception = reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1; - void* thrown_object = - unwind_exception->exception_class == kOurDependentExceptionClass ? - ((__cxa_dependent_exception*)exception_header)->primaryException : - exception_header + 1; - const __shim_type_info* thrown_type = - static_cast<const __shim_type_info*>(exception_header->exceptionType); - const __shim_type_info* catch_type = - static_cast<const __shim_type_info*>(&typeid(exception)); - // If the uncaught exception can be caught with std::exception& - if (catch_type->can_catch(thrown_type, thrown_object)) + bool native_exception = (unwind_exception->exception_class & get_language) == + (kOurExceptionClass & get_language); + if (native_exception) { - // Include the what() message from the exception - const exception* e = static_cast<const exception*>(thrown_object); - abort_message("terminating with %s exception: %s", cause, e->what()); + void* thrown_object = + unwind_exception->exception_class == kOurDependentExceptionClass ? + ((__cxa_dependent_exception*)exception_header)->primaryException : + exception_header + 1; + const __shim_type_info* thrown_type = + static_cast<const __shim_type_info*>(exception_header->exceptionType); + const __shim_type_info* catch_type = + static_cast<const __shim_type_info*>(&typeid(exception)); + // If the uncaught exception can be caught with std::exception& + if (catch_type->can_catch(thrown_type, thrown_object)) + { + // Include the what() message from the exception + const exception* e = static_cast<const exception*>(thrown_object); + abort_message("terminating with %s exception of type %s: %s", + cause, thrown_type->name(), e->what()); + } + else + // Else just note that we're terminating with an exception + abort_message("terminating with %s exception of type %s", + cause, thrown_type->name()); } else - // Else just note that we're terminating with an exception - abort_message("terminating with %s exception", cause); + // Else we're terminating with a foreign exception + abort_message("terminating with %s foreign exception", cause); } } // Else just note that we're terminating |