1*472758f3SLionel Sambuc //===------------------------------- unwind.h -----------------------------===// 2*472758f3SLionel Sambuc // 3*472758f3SLionel Sambuc // The LLVM Compiler Infrastructure 4*472758f3SLionel Sambuc // 5*472758f3SLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open 6*472758f3SLionel Sambuc // Source Licenses. See LICENSE.TXT for details. 7*472758f3SLionel Sambuc // 8*472758f3SLionel Sambuc // 9*472758f3SLionel Sambuc // C++ ABI Level 1 ABI documented at: 10*472758f3SLionel Sambuc // http://mentorembedded.github.io/cxx-abi/abi-eh.html 11*472758f3SLionel Sambuc // 12*472758f3SLionel Sambuc //===----------------------------------------------------------------------===// 13*472758f3SLionel Sambuc 14*472758f3SLionel Sambuc #ifndef _UNWIND_H 15*472758f3SLionel Sambuc #define _UNWIND_H 16*472758f3SLionel Sambuc 17*472758f3SLionel Sambuc #include <stdint.h> 18*472758f3SLionel Sambuc #include <stddef.h> 19*472758f3SLionel Sambuc 20*472758f3SLionel Sambuc typedef enum { 21*472758f3SLionel Sambuc _URC_NO_REASON = 0, 22*472758f3SLionel Sambuc _URC_FOREIGN_EXCEPTION_CAUGHT = 1, 23*472758f3SLionel Sambuc _URC_FATAL_PHASE2_ERROR = 2, 24*472758f3SLionel Sambuc _URC_FATAL_PHASE1_ERROR = 3, 25*472758f3SLionel Sambuc _URC_NORMAL_STOP = 4, 26*472758f3SLionel Sambuc _URC_END_OF_STACK = 5, 27*472758f3SLionel Sambuc _URC_HANDLER_FOUND = 6, 28*472758f3SLionel Sambuc _URC_INSTALL_CONTEXT = 7, 29*472758f3SLionel Sambuc _URC_CONTINUE_UNWIND = 8 30*472758f3SLionel Sambuc } _Unwind_Reason_Code; 31*472758f3SLionel Sambuc 32*472758f3SLionel Sambuc typedef enum { 33*472758f3SLionel Sambuc _UA_SEARCH_PHASE = 1, 34*472758f3SLionel Sambuc _UA_CLEANUP_PHASE = 2, 35*472758f3SLionel Sambuc _UA_HANDLER_FRAME = 4, 36*472758f3SLionel Sambuc _UA_FORCE_UNWIND = 8, 37*472758f3SLionel Sambuc _UA_END_OF_STACK = 16 /* GCC extension */ 38*472758f3SLionel Sambuc } _Unwind_Action; 39*472758f3SLionel Sambuc 40*472758f3SLionel Sambuc struct _Unwind_Context; 41*472758f3SLionel Sambuc 42*472758f3SLionel Sambuc struct _Unwind_Exception { 43*472758f3SLionel Sambuc uint64_t exception_class; 44*472758f3SLionel Sambuc void (*exception_cleanup)(_Unwind_Reason_Code, struct _Unwind_Exception *); 45*472758f3SLionel Sambuc uintptr_t private_1; 46*472758f3SLionel Sambuc uintptr_t private_2; 47*472758f3SLionel Sambuc } __attribute__((__aligned__)); 48*472758f3SLionel Sambuc 49*472758f3SLionel Sambuc typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int, _Unwind_Action, uint64_t, 50*472758f3SLionel Sambuc struct _Unwind_Exception *, 51*472758f3SLionel Sambuc struct _Unwind_Context *, 52*472758f3SLionel Sambuc void *); 53*472758f3SLionel Sambuc 54*472758f3SLionel Sambuc typedef _Unwind_Reason_Code (*__personality_routine)(int, _Unwind_Action, 55*472758f3SLionel Sambuc uint64_t, 56*472758f3SLionel Sambuc struct _Unwind_Exception *, 57*472758f3SLionel Sambuc struct _Unwind_Context *); 58*472758f3SLionel Sambuc 59*472758f3SLionel Sambuc __BEGIN_DECLS 60*472758f3SLionel Sambuc 61*472758f3SLionel Sambuc _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *); 62*472758f3SLionel Sambuc void _Unwind_Resume(struct _Unwind_Exception *) __dead; 63*472758f3SLionel Sambuc _Unwind_Reason_Code _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *); 64*472758f3SLionel Sambuc _Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *, 65*472758f3SLionel Sambuc _Unwind_Stop_Fn, void *); 66*472758f3SLionel Sambuc void _Unwind_DeleteException(struct _Unwind_Exception *); 67*472758f3SLionel Sambuc uintptr_t _Unwind_GetGR(struct _Unwind_Context *, int); 68*472758f3SLionel Sambuc void _Unwind_SetGR(struct _Unwind_Context *, int, uintptr_t); 69*472758f3SLionel Sambuc uintptr_t _Unwind_GetIP(struct _Unwind_Context *); 70*472758f3SLionel Sambuc uintptr_t _Unwind_GetCFA(struct _Unwind_Context *); 71*472758f3SLionel Sambuc void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t); 72*472758f3SLionel Sambuc uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *); 73*472758f3SLionel Sambuc uintptr_t _Unwind_GetLanguageSpecificData(struct _Unwind_Context *); 74*472758f3SLionel Sambuc uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context *); 75*472758f3SLionel Sambuc uintptr_t _Unwind_GetTextRelBase(struct _Unwind_Context *); 76*472758f3SLionel Sambuc 77*472758f3SLionel Sambuc typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *, 78*472758f3SLionel Sambuc void *); 79*472758f3SLionel Sambuc _Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *); 80*472758f3SLionel Sambuc void *_Unwind_FindEnclosingFunction(void *); 81*472758f3SLionel Sambuc 82*472758f3SLionel Sambuc void __register_frame(const void *); 83*472758f3SLionel Sambuc void __register_frame_info(const void *, void *); 84*472758f3SLionel Sambuc void __deregister_frame(const void *); 85*472758f3SLionel Sambuc void *__deregister_frame_info(const void *); 86*472758f3SLionel Sambuc 87*472758f3SLionel Sambuc __END_DECLS 88*472758f3SLionel Sambuc 89*472758f3SLionel Sambuc #endif // _UNWIND_H 90