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