00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef __SYS_IA64_UNWIND_H
00046 #define __SYS_IA64_UNWIND_H
00047
00048 #define VERSION_NUMBER 1
00049
00050 #include <sys/sl/unwind_sl.h>
00051
00052 #ifndef _LP64
00053
00054 typedef struct unw_sigaltstack {
00055 uint64_t ss_sp;
00056 uint32_t ss_flags;
00057 uint32_t ss_empty;
00058 uint64_t ss_size;
00059 } unw_stack_t;
00060
00061 #define __UNW_STRUCT_FPREG long double
00062
00063
00064 struct _Unwind_Exception;
00065
00066 struct sigcontext {
00067 uint64_t sc_flags;
00068 uint64_t sc_nat;
00069 unw_stack_t sc_stack;
00070
00071 uint64_t sc_ip;
00072 uint64_t sc_cfm;
00073 uint64_t sc_psr;
00074 #if 1
00075 uint64_t sc_ar_rsc;
00076 uint64_t sc_ar_bsp;
00077 uint64_t sc_ar_rnat;
00078 uint64_t sc_ar_ccv;
00079 uint64_t sc_ar_unat;
00080 uint64_t sc_ar_fpsr;
00081 uint64_t sc_ar_pfs;
00082 uint64_t sc_ar_ec;
00083 uint64_t sc_ar_lc;
00084 #else
00085 uint64_t sc_ar[128];
00086 #endif
00087 uint64_t sc_pr;
00088 uint64_t sc_br[8];
00089 uint64_t sc_gr[128];
00090 __UNW_STRUCT_FPREG sc_fr[128];
00091
00092
00093
00094
00095
00096 uint64_t sc_mask;
00097 };
00098
00099 #else
00100 #include <signal.h>
00101
00102 #define __UNW_STRUCT_FPREG struct ia64_fpreg
00103
00104 #endif
00105
00106 struct _Unwind_Context
00107 {
00108 uint64_t unwind_table_addr;
00109 uint64_t unwind_info_addr;
00110 uint64_t sc_priunat;
00111 uint64_t sc_ar_ec;
00112 struct sigcontext context;
00113 };
00114
00115 typedef struct _Unwind_Context unw_sigcontext_t;
00116
00117 #ifdef __cplusplus
00118 extern "C" {
00119 #endif
00120
00121
00122 typedef enum {
00123
00124
00125
00126
00127 _URC_NO_REASON = 0,
00128
00129
00130
00131
00132
00133
00134 _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
00135
00136
00137
00138
00139
00140 _URC_FATAL_PHASE2_ERROR = 2,
00141
00142
00143
00144
00145
00146
00147 _URC_FATAL_PHASE1_ERROR = 3,
00148
00149
00150
00151
00152 _URC_NORMAL_STOP = 4,
00153
00154
00155
00156
00157
00158
00159
00160 _URC_END_OF_STACK = 5,
00161
00162
00163
00164 _URC_HANDLER_FOUND = 6,
00165
00166
00167
00168 _URC_INSTALL_CONTEXT = 7
00169 } _Unwind_Reason_Code;
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 typedef int _Unwind_Action;
00195 #if 1
00196 #define _UA_SEARCH_PHASE 1
00197 #define _UA_CLEANUP_PHASE 2
00198 #define _UA_HANDLER_FRAME 4
00199 #define _UA_FORCE_UNWIND 8
00200 #else
00201 const _Unwind_Action _UA_SEARCH_PHASE = 1;
00202 const _Unwind_Action _UA_CLEANUP_PHASE = 2;
00203 const _Unwind_Action _UA_HANDLER_FRAME = 4;
00204 const _Unwind_Action _UA_FORCE_UNWIND = 8;
00205 #endif
00206
00207 struct _Unwind_Exception;
00208
00209 typedef void (*_Unwind_Exception_Cleanup_Fn)
00210 (_Unwind_Reason_Code reason,
00211 struct _Unwind_Exception *exc);
00212
00213 struct _Unwind_Exception {
00214 uint64_t exception_class;
00215 _Unwind_Exception_Cleanup_Fn exception_cleanup;
00216 uint64_t private_1;
00217 uint64_t private_2;
00218 };
00219
00220 typedef _Unwind_Reason_Code (* __personality_routine)
00221 (int version,
00222 _Unwind_Action actions,
00223 uint64_t exceptionClass,
00224 struct _Unwind_Exception *exceptionObject,
00225 struct _Unwind_Context *context);
00226
00227 typedef _Unwind_Reason_Code (* _Unwind_Stop_Fn)
00228 (int version,
00229 _Unwind_Action actions,
00230 uint64_t exceptionClass,
00231 struct _Unwind_Exception *exceptionObject,
00232 struct _Unwind_Context *context,
00233 void* stop_parameter);
00234
00235
00236 _Unwind_Reason_Code
00237 _Unwind_RaiseException(
00238 struct _Unwind_Exception *exception_object);
00239
00240 _Unwind_Reason_Code
00241 _Unwind_ForceUnwind(
00242 struct _Unwind_Exception *exception_object,
00243 _Unwind_Stop_Fn stop,
00244 void* stop_parameter);
00245
00246 void
00247 _Unwind_Resume(
00248 struct _Unwind_Exception *exception_object);
00249
00250 void
00251 _Unwind_DeleteException(
00252 struct _Unwind_Exception *exception_object);
00253
00254
00255 uint64_t
00256 _Unwind_GetGR(
00257 struct _Unwind_Context *context,
00258 int index);
00259
00260 void
00261 _Unwind_SetGR(
00262 struct _Unwind_Context *context,
00263 int index,
00264 uint64_t new_value);
00265
00266 uint64_t
00267 _Unwind_GetIP(
00268 struct _Unwind_Context *context);
00269
00270 void
00271 _Unwind_SetIP(
00272 struct _Unwind_Context *context,
00273 uint64_t new_value);
00274
00275 uint64_t
00276 _Unwind_GetLanguageSpecificData(
00277 struct _Unwind_Context *context);
00278
00279 uint64_t
00280 _Unwind_GetRegionStart(
00281 struct _Unwind_Context *context);
00282
00283 int __cxa_personality_routine(
00284 int version,
00285 int phase,
00286 uint64_t exceptionClass,
00287 struct _Unwind_Exception *exceptionObject,
00288 struct _Unwind_Context *context);
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304 __unw_error_t unwind_init(void);
00305 __unw_error_t unwind_fini(void);
00306
00307
00308
00309 __unw_error_t unwind_frame(unw_sigcontext_t *scp);
00310
00311
00312 void unwind_debugger_init(int (*dbg_unwind_table_addr_arg)(uint64_t,
00313 uint64_t *, uint64_t *),
00314 int (*dbg_unwind_info_addr_arg)(uint64_t,
00315 uint64_t *, uint64_t *),
00316 int (*dbg_unwind_info_target_addr_arg)(uint64_t,
00317 uint64_t *),
00318 int (*dbg_text_segment_target_addr_arg)(uint64_t,
00319 uint64_t *),
00320 int (*dbg_restore_gp_arg)(uint64_t,
00321 uint64_t *),
00322 int (*dbg_addr_read_arg)(uint64_t,
00323 uint64_t, void *));
00324
00325
00326
00327 int
00328 trace_back_stack(
00329 int num,
00330 uint64_t *ips,
00331 const char **names,
00332 int ips_sz,
00333 int names_sz);
00334
00335
00336 #ifdef __cplusplus
00337 }
00338 #endif
00339
00340 #endif