summaryrefslogtreecommitdiff
path: root/src/cxa_exception.hpp
diff options
context:
space:
mode:
authorMarshall Clow <mclow@qualcomm.com>2011-07-20 14:53:53 +0000
committerMarshall Clow <mclow@qualcomm.com>2011-07-20 14:53:53 +0000
commit61b898e4f717ecb3ce6aaa2652f7da712452d693 (patch)
tree412c828669c113d7696154255d823ef9acefc0a8 /src/cxa_exception.hpp
parent703d148d5994d7a1cd189dc57acc7704f48fbd13 (diff)
Exception handling stuctures, and thread-local variables for exception handling
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@135586 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/cxa_exception.hpp')
-rw-r--r--src/cxa_exception.hpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/src/cxa_exception.hpp b/src/cxa_exception.hpp
new file mode 100644
index 0000000..eda9951
--- /dev/null
+++ b/src/cxa_exception.hpp
@@ -0,0 +1,95 @@
+#include <exception> // for std::unexpected_handler and std::terminate_handler
+#include <cxxabi.h>
+#include "unwind.h"
+
+namespace __cxxabiv1 {
+
+ struct __cxa_exception {
+#if __LP64__
+ // This is a new field to support C++ 0x exception_ptr.
+ // For binary compatibility it is at the start of this
+ // struct which is prepended to the object thrown in
+ // __cxa_allocate_exception.
+ size_t referenceCount;
+#endif
+
+ // Manage the exception object itself.
+ std::type_info *exceptionType;
+ void (*exceptionDestructor)(void *);
+ std::unexpected_handler unexpectedHandler;
+ std::terminate_handler terminateHandler;
+
+ __cxa_exception *nextException;
+
+ int handlerCount;
+
+#ifdef __ARM_EABI_UNWINDER__
+ __cxa_exception* nextPropagatingException;
+ int propagationCount;
+#else
+ int handlerSwitchValue;
+ const unsigned char *actionRecord;
+ const unsigned char *languageSpecificData;
+ void *catchTemp;
+ void *adjustedPtr;
+#endif
+
+#if !__LP64__
+ // This is a new field to support C++ 0x exception_ptr.
+ // For binary compatibility it is placed where the compiler
+ // previously adding padded to 64-bit align unwindHeader.
+ size_t referenceCount;
+#endif
+
+ _Unwind_Exception unwindHeader;
+ };
+
+ struct __cxa_dependent_exception {
+#if __LP64__
+ void* primaryException;
+#endif
+
+ // Unused dummy data (should be set to null)
+ std::type_info *exceptionType;
+ void (*exceptionDestructor)(void *);
+
+ std::unexpected_handler unexpectedHandler;
+ std::terminate_handler terminateHandler;
+
+ __cxa_exception *nextException;
+
+ int handlerCount;
+
+#ifdef __ARM_EABI_UNWINDER__
+ __cxa_exception* nextPropagatingException;
+ int propagationCount;
+#else
+ int handlerSwitchValue;
+ const unsigned char *actionRecord;
+ const unsigned char *languageSpecificData;
+ void * catchTemp;
+ void *adjustedPtr;
+#endif
+
+#if !__LP64__
+ void* primaryException;
+#endif
+
+ _Unwind_Exception unwindHeader;
+ };
+
+ struct __cxa_eh_globals {
+ __cxa_exception * caughtExceptions;
+ unsigned int uncaughtExceptions;
+#ifdef __ARM_EABI_UNWINDER__
+ __cxa_exception* propagatingExceptions;
+#endif
+ };
+
+ extern "C" __cxa_eh_globals * __cxa_get_globals () throw();
+ extern "C" __cxa_eh_globals * __cxa_get_globals_fast () throw();
+
+ extern "C" void * __cxa_allocate_dependent_exception () throw();
+ extern "C" void __cxa_free_dependent_exception (void * dependent_exception) throw();
+
+} \ No newline at end of file