File indexing completed on 2026-05-10 08:57:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef __UNWIND_H__
0014 #define __UNWIND_H__
0015
0016 #include <__libunwind_config.h>
0017
0018 #include <stdint.h>
0019 #include <stddef.h>
0020
0021 #if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) && defined(_WIN32)
0022 #include <windows.h>
0023 #include <ntverp.h>
0024 #endif
0025
0026 #if defined(__APPLE__)
0027 #define LIBUNWIND_UNAVAIL __attribute__ (( unavailable ))
0028 #else
0029 #define LIBUNWIND_UNAVAIL
0030 #endif
0031
0032 typedef enum {
0033 _URC_NO_REASON = 0,
0034 _URC_OK = 0,
0035 _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
0036 _URC_FATAL_PHASE2_ERROR = 2,
0037 _URC_FATAL_PHASE1_ERROR = 3,
0038 _URC_NORMAL_STOP = 4,
0039 _URC_END_OF_STACK = 5,
0040 _URC_HANDLER_FOUND = 6,
0041 _URC_INSTALL_CONTEXT = 7,
0042 _URC_CONTINUE_UNWIND = 8,
0043 #if defined(_LIBUNWIND_ARM_EHABI)
0044 _URC_FAILURE = 9
0045 #endif
0046 } _Unwind_Reason_Code;
0047
0048 typedef enum {
0049 _UA_SEARCH_PHASE = 1,
0050 _UA_CLEANUP_PHASE = 2,
0051 _UA_HANDLER_FRAME = 4,
0052 _UA_FORCE_UNWIND = 8,
0053 _UA_END_OF_STACK = 16
0054 } _Unwind_Action;
0055
0056 typedef struct _Unwind_Context _Unwind_Context;
0057
0058 #if defined(_LIBUNWIND_ARM_EHABI)
0059 #include <unwind_arm_ehabi.h>
0060 #else
0061 #include <unwind_itanium.h>
0062 #endif
0063
0064 typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
0065 (int version,
0066 _Unwind_Action actions,
0067 _Unwind_Exception_Class exceptionClass,
0068 _Unwind_Exception* exceptionObject,
0069 struct _Unwind_Context* context,
0070 void* stop_parameter);
0071
0072 #ifdef __cplusplus
0073 extern "C" {
0074 #endif
0075
0076 extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context);
0077 extern uintptr_t
0078 _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context);
0079 #ifdef __USING_SJLJ_EXCEPTIONS__
0080 extern _Unwind_Reason_Code
0081 _Unwind_SjLj_ForcedUnwind(_Unwind_Exception *exception_object,
0082 _Unwind_Stop_Fn stop, void *stop_parameter);
0083 #else
0084 extern _Unwind_Reason_Code
0085 _Unwind_ForcedUnwind(_Unwind_Exception *exception_object,
0086 _Unwind_Stop_Fn stop, void *stop_parameter);
0087 #endif
0088
0089 #ifdef __USING_SJLJ_EXCEPTIONS__
0090 typedef struct _Unwind_FunctionContext *_Unwind_FunctionContext_t;
0091 extern void _Unwind_SjLj_Register(_Unwind_FunctionContext_t fc);
0092 extern void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t fc);
0093 #endif
0094
0095
0096
0097
0098
0099
0100
0101
0102 #ifdef __USING_SJLJ_EXCEPTIONS__
0103 extern _Unwind_Reason_Code
0104 _Unwind_SjLj_Resume_or_Rethrow(_Unwind_Exception *exception_object);
0105 #else
0106 extern _Unwind_Reason_Code
0107 _Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object);
0108 #endif
0109
0110
0111
0112
0113 typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *,
0114 void *);
0115 extern _Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *);
0116
0117
0118
0119
0120 extern uintptr_t _Unwind_GetCFA(struct _Unwind_Context *);
0121
0122
0123
0124
0125
0126
0127
0128
0129 extern uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context,
0130 int *ipBefore);
0131
0132
0133
0134
0135
0136
0137
0138
0139 extern void __register_frame(const void *fde);
0140 extern void __deregister_frame(const void *fde);
0141
0142
0143
0144
0145
0146
0147 struct dwarf_eh_bases {
0148 uintptr_t tbase;
0149 uintptr_t dbase;
0150 uintptr_t func;
0151 };
0152 extern const void *_Unwind_Find_FDE(const void *pc, struct dwarf_eh_bases *);
0153
0154
0155
0156
0157
0158
0159
0160 extern void *_Unwind_FindEnclosingFunction(void *pc);
0161
0162
0163
0164 extern uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context *context)
0165 LIBUNWIND_UNAVAIL;
0166 extern uintptr_t _Unwind_GetTextRelBase(struct _Unwind_Context *context)
0167 LIBUNWIND_UNAVAIL;
0168
0169
0170
0171
0172 extern void __register_frame_info_bases(const void *fde, void *ob, void *tb,
0173 void *db) LIBUNWIND_UNAVAIL;
0174 extern void __register_frame_info(const void *fde, void *ob)
0175 LIBUNWIND_UNAVAIL;
0176 extern void __register_frame_info_table_bases(const void *fde, void *ob,
0177 void *tb, void *db)
0178 LIBUNWIND_UNAVAIL;
0179 extern void __register_frame_info_table(const void *fde, void *ob)
0180 LIBUNWIND_UNAVAIL;
0181 extern void __register_frame_table(const void *fde)
0182 LIBUNWIND_UNAVAIL;
0183 extern void *__deregister_frame_info(const void *fde)
0184 LIBUNWIND_UNAVAIL;
0185 extern void *__deregister_frame_info_bases(const void *fde)
0186 LIBUNWIND_UNAVAIL;
0187
0188 #if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
0189 #ifndef _WIN32
0190 typedef struct _EXCEPTION_RECORD EXCEPTION_RECORD;
0191 typedef struct _CONTEXT CONTEXT;
0192 typedef struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT;
0193 #elif !defined(__MINGW32__) && VER_PRODUCTBUILD < 8000
0194 typedef struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT;
0195 #endif
0196
0197 extern EXCEPTION_DISPOSITION _GCC_specific_handler(EXCEPTION_RECORD *exc,
0198 void *frame, CONTEXT *ctx,
0199 DISPATCHER_CONTEXT *disp,
0200 _Unwind_Personality_Fn pers);
0201 #endif
0202
0203 #ifdef __cplusplus
0204 }
0205 #endif
0206
0207 #endif