hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 1 | /* libunwind - a platform-independent unwind library |
| 2 | Copyright (C) 2001-2002 Hewlett-Packard Co |
| 3 | Contributed by David Mosberger-Tang <davidm@hpl.hp.com> |
| 4 | |
| 5 | This file is part of libunwind. |
| 6 | |
mostang.com!davidm | aca3843 | 2002-11-16 03:25:36 +0000 | [diff] [blame] | 7 | Permission is hereby granted, free of charge, to any person obtaining |
| 8 | a copy of this software and associated documentation files (the |
| 9 | "Software"), to deal in the Software without restriction, including |
| 10 | without limitation the rights to use, copy, modify, merge, publish, |
| 11 | distribute, sublicense, and/or sell copies of the Software, and to |
| 12 | permit persons to whom the Software is furnished to do so, subject to |
| 13 | the following conditions: |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 14 | |
mostang.com!davidm | aca3843 | 2002-11-16 03:25:36 +0000 | [diff] [blame] | 15 | The above copyright notice and this permission notice shall be |
| 16 | included in all copies or substantial portions of the Software. |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 17 | |
mostang.com!davidm | aca3843 | 2002-11-16 03:25:36 +0000 | [diff] [blame] | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 25 | |
| 26 | #define UNW_PASTE2(x,y) x##y |
| 27 | #define UNW_PASTE(x,y) UNW_PASTE2(x,y) |
| 28 | #define UNW_OBJ(fn) UNW_PASTE(UNW_PREFIX, fn) |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 29 | #define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn) |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 30 | |
| 31 | #ifdef UNW_LOCAL_ONLY |
| 32 | # define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UL,UNW_TARGET),_) |
| 33 | #else /* !UNW_LOCAL_ONLY */ |
| 34 | # define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_) |
| 35 | #endif /* !UNW_LOCAL_ONLY */ |
| 36 | |
| 37 | typedef unw_tdep_word_t unw_word_t; |
| 38 | |
| 39 | /* This needs to be big enough to accommodate the unwind state of any |
| 40 | architecture, while leaving some slack for future expansion. |
| 41 | Changing this value will require recompiling all users of this |
| 42 | library. */ |
| 43 | #define UNW_STATE_LEN 127 |
| 44 | |
| 45 | /* Error codes. The unwind routines return the *negated* values of |
| 46 | these error codes on error and a non-negative value on success. */ |
| 47 | typedef enum |
| 48 | { |
| 49 | UNW_ESUCCESS = 0, /* no error */ |
| 50 | UNW_EUNSPEC, /* unspecified (general) error */ |
| 51 | UNW_ENOMEM, /* out of memory */ |
| 52 | UNW_EBADREG, /* bad register number */ |
| 53 | UNW_EREADONLYREG, /* attempt to write read-only register */ |
| 54 | UNW_ESTOPUNWIND, /* stop unwinding */ |
| 55 | UNW_EINVALIDIP, /* invalid IP */ |
| 56 | UNW_EBADFRAME, /* bad frame */ |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 57 | UNW_EINVAL, /* unsupported operation or bad value */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 58 | UNW_EBADVERSION, /* unwind info has unsupported version */ |
| 59 | UNW_ENOINFO /* no unwind info found */ |
| 60 | } |
| 61 | unw_error_t; |
| 62 | |
| 63 | /* The following enum defines the indices for a couple of |
| 64 | (pseudo-)registers which have the same meaning across all |
| 65 | platforms. (RO) means read-only. (RW) means read-write. General |
| 66 | registers (aka "integer registers") are expected to start with |
| 67 | index 0. The number of such registers is architecture-dependent. |
| 68 | The remaining indices can be used as an architecture sees fit. The |
| 69 | last valid register index is given by UNW_REG_LAST. */ |
| 70 | typedef enum |
| 71 | { |
| 72 | UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */ |
| 73 | UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 74 | UNW_REG_LAST = UNW_TDEP_LAST_REG |
| 75 | } |
| 76 | unw_frame_regnum_t; |
| 77 | |
mostang.com!davidm | 16f2189 | 2002-11-09 07:59:02 +0000 | [diff] [blame] | 78 | typedef enum |
| 79 | { |
| 80 | UNW_CACHE_NONE, /* no caching */ |
| 81 | UNW_CACHE_GLOBAL, /* shared global cache */ |
| 82 | UNW_CACHE_PER_THREAD /* per-thread caching */ |
| 83 | } |
| 84 | unw_caching_policy_t; |
| 85 | |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 86 | typedef int unw_regnum_t; |
| 87 | |
| 88 | /* The unwind cursor starts at the youngest (most deeply nested) frame |
| 89 | and is used to track the frame state as the unwinder steps from |
| 90 | frame to frame. It is safe to make (shallow) copies of variables |
| 91 | of this type. */ |
| 92 | typedef struct unw_cursor |
| 93 | { |
| 94 | unw_word_t opaque[UNW_STATE_LEN]; |
| 95 | } |
| 96 | unw_cursor_t; |
| 97 | |
| 98 | /* This type encapsulates the entire (preserved) machine-state. */ |
| 99 | typedef unw_tdep_context_t unw_context_t; |
| 100 | |
| 101 | /* unw_getcontext() fills the unw_context_t pointed to by UC with the |
| 102 | machine state as it exists at the call-site. For implementation |
| 103 | reasons, this needs to be a target-dependent macro. It's easiest |
| 104 | to think of unw_getcontext() as being identical to getcontext(). */ |
| 105 | #define unw_getcontext(uc) unw_tdep_getcontext(uc) |
| 106 | |
| 107 | /* We will assume that "long double" is sufficiently large and aligned |
| 108 | to hold the contents of a floating-point register. Note that the |
| 109 | fp register format is not usually the same format as a "long |
| 110 | double". Instead, the content of unw_fpreg_t should be manipulated |
| 111 | only through the "raw.bits" member. */ |
| 112 | typedef union |
| 113 | { |
| 114 | struct { unw_word_t bits[1]; } raw; |
| 115 | long double dummy; /* dummy to force 16-byte alignment */ |
| 116 | } |
| 117 | unw_fpreg_t; |
| 118 | |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 119 | typedef struct unw_addr_space *unw_addr_space_t; |
| 120 | |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 121 | typedef struct unw_proc_info |
| 122 | { |
| 123 | unw_word_t start_ip; /* first IP covered by this procedure */ |
| 124 | unw_word_t end_ip; /* first IP NOT covered by this procedure */ |
| 125 | unw_word_t lsda; /* address of lang.-spec. data area (if any) */ |
| 126 | unw_word_t handler; /* optional personality routine */ |
| 127 | unw_word_t gp; /* global-pointer value for this procedure */ |
| 128 | unw_word_t flags; /* misc. flags */ |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 129 | |
| 130 | int format; /* unwind-info format (arch-specific) */ |
mostang.com!davidm | b6251b0 | 2002-12-12 09:17:41 +0000 | [diff] [blame^] | 131 | int unwind_info_size; /* size of the informat (if applicable) */ |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 132 | void *unwind_info; /* unwind-info (arch-specific) */ |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 133 | } |
| 134 | unw_proc_info_t; |
| 135 | |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 136 | /* These are backend callback routines that provide access to the |
| 137 | state of a "remote" process. This can be used, for example, to |
| 138 | unwind another process through the ptrace() interface. */ |
| 139 | typedef struct unw_accessors |
| 140 | { |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 141 | /* Look up the unwind info associated with instruction-pointer IP. |
| 142 | On success, the routine fills in the PROC_INFO structure. */ |
| 143 | int (*find_proc_info) (unw_addr_space_t as, unw_word_t ip, |
mostang.com!davidm | b6251b0 | 2002-12-12 09:17:41 +0000 | [diff] [blame^] | 144 | unw_proc_info_t *proc_info, |
| 145 | int need_unwind_info, |
| 146 | void *arg); |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 147 | |
mostang.com!davidm | b6251b0 | 2002-12-12 09:17:41 +0000 | [diff] [blame^] | 148 | /* Release any resources (e.g., memory) that were allocated for |
| 149 | the unwind info returned in by a previous call to |
| 150 | find_proc_info() with NEED_UNWIND_INFO set to 1. */ |
| 151 | void (*put_unwind_info) (unw_addr_space_t as, unw_proc_info_t *proc_info, |
| 152 | void *arg); |
| 153 | |
| 154 | /* Return the list-head of the dynamically registered unwind |
| 155 | info. */ |
| 156 | int (*get_dyn_info_list_addr) (unw_addr_space_t as, |
| 157 | unw_word_t *dyn_info_list_addr, |
| 158 | void *arg); |
| 159 | |
| 160 | /* Access aligned word at address ADDR. The value is returned |
| 161 | according to the endianness of the host (e.g., if the host is |
| 162 | little-endian and the target is big-endian, access_mem() needs |
| 163 | to byte-swap the value before returning it). */ |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 164 | int (*access_mem) (unw_addr_space_t as, unw_word_t addr, |
| 165 | unw_word_t *val, int write, void *arg); |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 166 | |
| 167 | /* Access register number REG at address ADDR. */ |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 168 | int (*access_reg) (unw_addr_space_t as, unw_regnum_t reg, |
| 169 | unw_word_t *val, int write, void *arg); |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 170 | |
| 171 | /* Access register number REG at address ADDR. */ |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 172 | int (*access_fpreg) (unw_addr_space_t as, unw_regnum_t reg, |
| 173 | unw_fpreg_t *val, int write, void *arg); |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 174 | |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 175 | int (*resume) (unw_addr_space_t as, unw_cursor_t *c, void *arg); |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 176 | } |
| 177 | unw_accessors_t; |
| 178 | |
| 179 | typedef enum unw_save_loc_type |
| 180 | { |
| 181 | UNW_SLT_NONE, /* register is not saved ("not an l-value") */ |
| 182 | UNW_SLT_MEMORY, /* register has been saved in memory */ |
| 183 | UNW_SLT_REG /* register has been saved in (another) register */ |
| 184 | } |
| 185 | unw_save_loc_type_t; |
| 186 | |
| 187 | typedef struct unw_save_loc |
| 188 | { |
| 189 | unw_save_loc_type_t type; |
| 190 | union |
| 191 | { |
| 192 | unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */ |
| 193 | unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */ |
| 194 | } |
| 195 | u; |
| 196 | unw_tdep_save_loc_t extra; /* target-dependent additional information */ |
| 197 | } |
| 198 | unw_save_loc_t; |
| 199 | |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 200 | #include <libunwind-dynamic.h> |
| 201 | |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 202 | /* These routines work both for local and remote unwinding. */ |
| 203 | |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 204 | extern unw_addr_space_t UNW_OBJ(local_addr_space); |
| 205 | |
mostang.com!davidm | b6251b0 | 2002-12-12 09:17:41 +0000 | [diff] [blame^] | 206 | extern unw_addr_space_t UNW_OBJ(create_addr_space) (unw_accessors_t *a, |
| 207 | int byte_order); |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 208 | extern unw_accessors_t *UNW_OBJ(get_accessors) (unw_addr_space_t as); |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 209 | extern void UNW_OBJ(destroy_addr_space) (unw_addr_space_t as); |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 210 | extern int UNW_OBJ(init_local) (unw_cursor_t *c, ucontext_t *u); |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 211 | extern int UNW_OBJ(init_remote) (unw_cursor_t *c, unw_addr_space_t as, |
| 212 | void *as_arg); |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 213 | extern int UNW_OBJ(step) (unw_cursor_t *c); |
| 214 | extern int UNW_OBJ(resume) (unw_cursor_t *c); |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 215 | extern int UNW_OBJ(get_proc_info) (unw_cursor_t *c, unw_proc_info_t *pi); |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 216 | extern int UNW_OBJ(get_reg) (unw_cursor_t *c, int regnum, unw_word_t *valp); |
| 217 | extern int UNW_OBJ(set_reg) (unw_cursor_t *c, int regnum, unw_word_t val); |
| 218 | extern int UNW_OBJ(get_fpreg) (unw_cursor_t *c, int regnum, unw_fpreg_t *val); |
| 219 | extern int UNW_OBJ(set_fpreg) (unw_cursor_t *c, int regnum, unw_fpreg_t val); |
| 220 | extern int UNW_OBJ(get_save_loc) (unw_cursor_t *c, int regnum, |
| 221 | unw_save_loc_t *loc); |
| 222 | extern int UNW_OBJ(is_signal_frame) (unw_cursor_t *c); |
mostang.com!davidm | b6251b0 | 2002-12-12 09:17:41 +0000 | [diff] [blame^] | 223 | extern int UNW_OBJ(get_proc_name) (unw_cursor_t *c, char *buf, size_t buf_len); |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 224 | extern const char *UNW_ARCH_OBJ(regname) (int regnum); |
mostang.com!davidm | b6251b0 | 2002-12-12 09:17:41 +0000 | [diff] [blame^] | 225 | extern void UNW_OBJ(flush_cache)(unw_addr_space_t as, |
| 226 | unw_word_t lo, unw_word_t hi); |
| 227 | extern int UNW_OBJ(set_caching_policy)(unw_addr_space_t as, |
| 228 | unw_caching_policy_t policy); |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 229 | |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 230 | #define unw_local_addr_space UNW_OBJ(local_addr_space) |
| 231 | |
| 232 | /* Create a new address space (in addition to the default |
mostang.com!davidm | b6251b0 | 2002-12-12 09:17:41 +0000 | [diff] [blame^] | 233 | local_addr_space). BYTE_ORDER can be 0 to select the default |
| 234 | byte-order or one of the byte-order values defined by <endian.h> |
| 235 | (e.g., __LITLE_ENDIAN or __BIG_ENDIAN). The default byte-order is |
| 236 | either implied by the target architecture (e.g., x86 is always |
| 237 | little-endian) or is select based on the byte-order of the host. |
| 238 | |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 239 | This routine is NOT signal-safe. */ |
mostang.com!davidm | b6251b0 | 2002-12-12 09:17:41 +0000 | [diff] [blame^] | 240 | #define unw_create_addr_space(a,b) UNW_OBJ(create_addr_space)(a,b) |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 241 | |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 242 | /* Retrieve a pointer to the accessors structure associated with |
| 243 | address space AS. |
| 244 | This routine is signal-safe. */ |
| 245 | #define unw_get_accessors(as) UNW_OBJ(get_accessors)(as) |
| 246 | |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 247 | /* Destroy an address space. |
| 248 | This routine is NOT signal-safe. */ |
| 249 | #define unw_destroy_addr_space(as) UNW_OBJ(destroy_addr_space)(as) |
| 250 | |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 251 | /* Initialize cursor C such that unwinding starts at the point |
| 252 | represented by the context U. Returns zero on success, negative |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 253 | value on failure. |
| 254 | This routine is signal-safe. */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 255 | #define unw_init_local(c,u) UNW_OBJ(init_local)(c, u) |
| 256 | |
| 257 | /* Initialize cursor C such that it accesses the unwind target through |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 258 | accessors A. |
| 259 | This routine is signal-safe. */ |
| 260 | #define unw_init_remote(c,a,arg) UNW_OBJ(init_remote)(c, a, arg) |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 261 | |
| 262 | /* Move cursor up by one step (up meaning toward earlier, less deeply |
| 263 | nested frames). Returns positive number if there are more frames |
| 264 | to unwind, 0 if last frame has been reached, negative number in |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 265 | case of an error. |
| 266 | This routine is signal-safe. */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 267 | #define unw_step(c) UNW_OBJ(step)(c) |
| 268 | |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 269 | /* Resume execution at the point identified by the cursor. |
| 270 | This routine is signal-safe. */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 271 | #define unw_resume(c) UNW_OBJ(resume)(c) |
| 272 | |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 273 | /* Return the proc-info associated with the cursor. |
| 274 | This routine is signal-safe. */ |
| 275 | #define unw_get_proc_info(c,p) UNW_OBJ(get_proc_info)(c,p) |
| 276 | |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 277 | /* Register accessor routines. Return zero on success, negative value |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 278 | on failure. |
| 279 | These routines are signal-safe. */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 280 | #define unw_get_reg(c,r,v) UNW_OBJ(get_reg)(c,r,v) |
| 281 | #define unw_set_reg(c,r,v) UNW_OBJ(set_reg)(c,r,v) |
| 282 | |
| 283 | /* Floating-point accessor routines. Return zero on success, negative |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 284 | value on failure. |
| 285 | These routines are signal-safe. */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 286 | #define unw_get_fpreg(c,r,v) UNW_OBJ(get_fpreg)(c,r,v) |
| 287 | #define unw_set_fpreg(c,r,v) UNW_OBJ(set_fpreg)(c,r,v) |
| 288 | |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 289 | /* Get the save-location of register R. |
| 290 | This routine is signal-safe. */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 291 | #define unw_get_save_loc(c,r,l) UNW_OBJ(get_save_loc)(c,r,l) |
| 292 | |
| 293 | /* Return 1 if register number R is a floating-point register, zero |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 294 | otherwise. |
| 295 | This routine is signal-safe. */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 296 | #define unw_is_fpreg(r) unw_tdep_is_fpreg(r) |
| 297 | |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 298 | /* Returns non-zero value if the cursor points to a signal frame. |
| 299 | This routine is signal-safe. */ |
hp.com!davidm | 76166fb | 2002-04-05 23:37:55 +0000 | [diff] [blame] | 300 | #define unw_is_signal_frame(c) UNW_OBJ(is_signal_frame)(c) |
mostang.com!davidm | 58142c0 | 2002-04-12 05:02:40 +0000 | [diff] [blame] | 301 | |
mostang.com!davidm | b6251b0 | 2002-12-12 09:17:41 +0000 | [diff] [blame^] | 302 | /* Return the name of the procedure that created the frame identified |
| 303 | by the cursor. The returned string is ASCII NUL terminated. If the |
| 304 | string buffer is too small to store the entire name, the first |
| 305 | portion of the string that can fit is stored in the buffer (along |
| 306 | with a terminating NUL character) and -UNW_ENOMEM is returned. If |
| 307 | no name can be determined, -UNW_ENOINFO is returned. */ |
| 308 | #define unw_get_proc_name(c,s,l) UNW_OBJ(get_proc_name)(c, s, l) |
| 309 | |
mostang.com!davidm | 58142c0 | 2002-04-12 05:02:40 +0000 | [diff] [blame] | 310 | /* Returns the canonical register name of register R. R must be in |
| 311 | the range from 0 to UNW_REG_LAST. Like all other unwind routines, |
| 312 | this one is re-entrant (i.e., the returned string must be a string |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 313 | constant. |
| 314 | This routine is signal-safe. */ |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 315 | #define unw_regname(r) UNW_ARCH_OBJ(regname)(r) |
mostang.com!davidm | 16f2189 | 2002-11-09 07:59:02 +0000 | [diff] [blame] | 316 | |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 317 | /* Sets the caching policy of address space AS. Caching can be |
| 318 | disabled completely by setting the policy to UNW_CACHE_NONE. With |
| 319 | UNW_CACHE_GLOBAL, there is a single cache that is shared across all |
| 320 | threads. With UNW_CACHE_PER_THREAD, each thread gets its own |
| 321 | cache, which can improve performance thanks to less locking and |
| 322 | better locality. By default, UNW_CACHE_GLOBAL is in effect. |
| 323 | This routine is NOT signal-safe. */ |
| 324 | #define unw_set_caching_policy(as, p) UNW_OBJ(set_caching_policy)(as, p) |
mostang.com!davidm | 16f2189 | 2002-11-09 07:59:02 +0000 | [diff] [blame] | 325 | |
| 326 | /* Flush all caches (global, per-thread, or any other caches that |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 327 | might exist) in address-space AS of information at least relating |
| 328 | to the address-range LO to HI (non-inclusive). LO and HI are only |
| 329 | a performance hint and the function is allowed to over-flush (i.e., |
| 330 | flush more than the requested address-range). Furthermore, if LO |
| 331 | and HI are both 0, the entire address-range is flushed. This |
| 332 | function must be called if any of unwind information might have |
| 333 | changed (e.g., because a library might have been removed via a call |
mostang.com!davidm | 50d7a15 | 2002-12-03 08:19:58 +0000 | [diff] [blame] | 334 | to dlclose()). |
| 335 | This routine is signal-safe. */ |
mostang.com!davidm | 87bc2e3 | 2002-11-16 06:50:04 +0000 | [diff] [blame] | 336 | #define unw_flush_cache(as,lo,hi) UNW_OBJ(flush_cache)(as, lo, hi) |