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