2 * Acess2 C++ Support Library
3 * - By John Hodge (thePowersGang)
5 * exception_handling_cxxabi.h
6 * - C++ Exception Handling definitions from the Itanium C++ ABI
8 #ifndef _EXCEPTION_HANLDING_CXXABI_H_
9 #define _EXCEPTION_HANLDING_CXXABI_H_
11 typedef void *(unexpected_handler)(void);
12 typedef void *(terminate_handler)(void);
14 struct _Unwind_Context;
18 _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
19 _URC_FATAL_PHASE2_ERROR = 2,
20 _URC_FATAL_PHASE1_ERROR = 3,
22 _URC_END_OF_STACK = 5,
23 _URC_HANDLER_FOUND = 6,
24 _URC_INSTALL_CONTEXT = 7,
25 _URC_CONTINUE_UNWIND = 8
26 } _Unwind_Reason_Code;
28 typedef int _Unwind_Action;
29 static const _Unwind_Action _UA_SEARCH_PHASE = 1;
30 static const _Unwind_Action _UA_CLEANUP_PHASE = 2;
31 static const _Unwind_Action _UA_HANDLER_FRAME = 4;
32 static const _Unwind_Action _UA_FORCE_UNWIND = 8;
34 typedef void (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code reason, struct _Unwind_Exception *exc);
36 struct _Unwind_Exception
38 uint64_t exception_class;
39 _Unwind_Exception_Cleanup_Fn exception_cleanup;
44 struct __cxa_exception
46 std::type_info* exceptionType;
47 void (*exceptionDestructor)(void *);
48 unexpected_handler* unexpectedHandler;
49 terminate_handler* terminateHandler;
50 __cxa_exception* nextException;
54 int handlerSwitchValue;
55 const char* actionRecord;
56 const char* languageSpecificData;
60 _Unwind_Exception unwindHeader;
63 #define EXCEPTION_CLASS_ACESS "Ac20C++\0"
65 typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int version, _Unwind_Action actions, uint64_t exception_class, struct _Unwind_Exception *exceptionObject, struct _Unwind_Context *context, void *stop_parameter);
68 extern "C" void __cxa_call_unexpected(void *);
69 extern "C" void *__cxa_allocate_exception(size_t thrown_size);
70 extern "C" void __cxa_free_exception(void *thrown_exception);
71 extern "C" void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void (*dest)(void*));
72 extern "C" void *__cxa_begin_catch(_Unwind_Exception *exceptionObject);
73 extern "C" void __cxa_end_catch();
76 extern "C" _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *exception_object);
77 extern "C" _Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *exception_object, _Unwind_Stop_Fn stop, void *stop_parameter);
78 extern "C" void _Unwind_DeleteException(struct _Unwind_Exception *exception_object);
79 extern "C" uint64_t _Unwind_GetGR(struct _Unwind_Context *context, int index);
80 extern "C" void _Unwind_SetGR(struct _Unwind_Context *context, int index, uint64_t new_value);
81 extern "C" uint64_t _Unwind_GetIP(struct _Unwind_Context *context);
82 extern "C" void _Unwind_SetIP(struct _Unwind_Context *context, uint64_t new_value);
83 extern "C" uint64_t _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context);
84 extern "C" uint64_t _Unwind_GetRegionStart(struct _Unwind_Context *context);