blob: 730ae8d53c98f6abeef7846496e9ad0919d77216 [file] [log] [blame]
hp.com!davidm76166fb2002-04-05 23:37:55 +00001/* libunwind - a platform-independent unwind library
mostang.com!davidm73438412003-02-27 09:58:57 +00002 Copyright (C) 2001-2003 Hewlett-Packard Co
hp.com!davidm76166fb2002-04-05 23:37:55 +00003 Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
4
5This file is part of libunwind.
6
mostang.com!davidmaca38432002-11-16 03:25:36 +00007Permission is hereby granted, free of charge, to any person obtaining
8a copy of this software and associated documentation files (the
9"Software"), to deal in the Software without restriction, including
10without limitation the rights to use, copy, modify, merge, publish,
11distribute, sublicense, and/or sell copies of the Software, and to
12permit persons to whom the Software is furnished to do so, subject to
13the following conditions:
hp.com!davidm76166fb2002-04-05 23:37:55 +000014
mostang.com!davidmaca38432002-11-16 03:25:36 +000015The above copyright notice and this permission notice shall be
16included in all copies or substantial portions of the Software.
hp.com!davidm76166fb2002-04-05 23:37:55 +000017
mostang.com!davidmaca38432002-11-16 03:25:36 +000018THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
hp.com!davidm76166fb2002-04-05 23:37:55 +000025
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!davidm50d7a152002-12-03 08:19:58 +000029#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn)
hp.com!davidm76166fb2002-04-05 23:37:55 +000030
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
hp.com!davidm76166fb2002-04-05 23:37:55 +000037/* Error codes. The unwind routines return the *negated* values of
38 these error codes on error and a non-negative value on success. */
39typedef enum
40 {
41 UNW_ESUCCESS = 0, /* no error */
42 UNW_EUNSPEC, /* unspecified (general) error */
43 UNW_ENOMEM, /* out of memory */
44 UNW_EBADREG, /* bad register number */
45 UNW_EREADONLYREG, /* attempt to write read-only register */
46 UNW_ESTOPUNWIND, /* stop unwinding */
47 UNW_EINVALIDIP, /* invalid IP */
48 UNW_EBADFRAME, /* bad frame */
mostang.com!davidm50d7a152002-12-03 08:19:58 +000049 UNW_EINVAL, /* unsupported operation or bad value */
hp.com!davidm76166fb2002-04-05 23:37:55 +000050 UNW_EBADVERSION, /* unwind info has unsupported version */
51 UNW_ENOINFO /* no unwind info found */
52 }
53unw_error_t;
54
55/* The following enum defines the indices for a couple of
56 (pseudo-)registers which have the same meaning across all
57 platforms. (RO) means read-only. (RW) means read-write. General
58 registers (aka "integer registers") are expected to start with
59 index 0. The number of such registers is architecture-dependent.
60 The remaining indices can be used as an architecture sees fit. The
61 last valid register index is given by UNW_REG_LAST. */
62typedef enum
63 {
64 UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */
65 UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */
mostang.com!davidmc670abb2003-03-06 06:14:36 +000066 UNW_REG_EH = UNW_TDEP_EH, /* (rw) exception-handling reg base */
hp.com!davidm76166fb2002-04-05 23:37:55 +000067 UNW_REG_LAST = UNW_TDEP_LAST_REG
68 }
69unw_frame_regnum_t;
70
mostang.com!davidmc670abb2003-03-06 06:14:36 +000071/* Number of exception-handler argument registers: */
72#define UNW_NUM_EH_REGS UNW_TDEP_NUM_EH_REGS
73
mostang.com!davidm16f21892002-11-09 07:59:02 +000074typedef enum
75 {
76 UNW_CACHE_NONE, /* no caching */
77 UNW_CACHE_GLOBAL, /* shared global cache */
78 UNW_CACHE_PER_THREAD /* per-thread caching */
79 }
80unw_caching_policy_t;
81
hp.com!davidm76166fb2002-04-05 23:37:55 +000082typedef int unw_regnum_t;
83
84/* The unwind cursor starts at the youngest (most deeply nested) frame
85 and is used to track the frame state as the unwinder steps from
86 frame to frame. It is safe to make (shallow) copies of variables
87 of this type. */
88typedef struct unw_cursor
89 {
mostang.com!davidma4bea2c2003-01-21 08:08:32 +000090 unw_word_t opaque[UNW_TDEP_CURSOR_LEN];
hp.com!davidm76166fb2002-04-05 23:37:55 +000091 }
92unw_cursor_t;
93
94/* This type encapsulates the entire (preserved) machine-state. */
95typedef unw_tdep_context_t unw_context_t;
96
97/* unw_getcontext() fills the unw_context_t pointed to by UC with the
98 machine state as it exists at the call-site. For implementation
99 reasons, this needs to be a target-dependent macro. It's easiest
100 to think of unw_getcontext() as being identical to getcontext(). */
101#define unw_getcontext(uc) unw_tdep_getcontext(uc)
102
mostang.com!davidm981c8cc2003-02-08 10:10:59 +0000103typedef unw_tdep_fpreg_t unw_fpreg_t;
hp.com!davidm76166fb2002-04-05 23:37:55 +0000104
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000105typedef struct unw_addr_space *unw_addr_space_t;
106
mostang.com!davidma4bea2c2003-01-21 08:08:32 +0000107/* This bit is set to indicate */
108#define UNW_PI_FLAG_FIRST_TDEP_BIT 16
109
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000110typedef struct unw_proc_info
111 {
112 unw_word_t start_ip; /* first IP covered by this procedure */
113 unw_word_t end_ip; /* first IP NOT covered by this procedure */
114 unw_word_t lsda; /* address of lang.-spec. data area (if any) */
115 unw_word_t handler; /* optional personality routine */
116 unw_word_t gp; /* global-pointer value for this procedure */
117 unw_word_t flags; /* misc. flags */
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000118
119 int format; /* unwind-info format (arch-specific) */
hp.com!davidmfbe40e52003-12-20 11:20:42 +0000120 int unwind_info_size; /* size of the information (if applicable) */
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000121 void *unwind_info; /* unwind-info (arch-specific) */
hp.com!davidmfbe40e52003-12-20 11:20:42 +0000122 unw_tdep_proc_info_t extra; /* target-dependent auxiliary proc-info */
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000123 }
124unw_proc_info_t;
125
hp.com!davidm76166fb2002-04-05 23:37:55 +0000126/* These are backend callback routines that provide access to the
127 state of a "remote" process. This can be used, for example, to
128 unwind another process through the ptrace() interface. */
129typedef struct unw_accessors
130 {
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000131 /* Look up the unwind info associated with instruction-pointer IP.
132 On success, the routine fills in the PROC_INFO structure. */
133 int (*find_proc_info) (unw_addr_space_t as, unw_word_t ip,
mostang.com!davidmb6251b02002-12-12 09:17:41 +0000134 unw_proc_info_t *proc_info,
135 int need_unwind_info,
136 void *arg);
hp.com!davidm76166fb2002-04-05 23:37:55 +0000137
mostang.com!davidmb6251b02002-12-12 09:17:41 +0000138 /* Release any resources (e.g., memory) that were allocated for
139 the unwind info returned in by a previous call to
140 find_proc_info() with NEED_UNWIND_INFO set to 1. */
141 void (*put_unwind_info) (unw_addr_space_t as, unw_proc_info_t *proc_info,
142 void *arg);
143
144 /* Return the list-head of the dynamically registered unwind
145 info. */
146 int (*get_dyn_info_list_addr) (unw_addr_space_t as,
147 unw_word_t *dyn_info_list_addr,
148 void *arg);
149
150 /* Access aligned word at address ADDR. The value is returned
151 according to the endianness of the host (e.g., if the host is
152 little-endian and the target is big-endian, access_mem() needs
153 to byte-swap the value before returning it). */
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000154 int (*access_mem) (unw_addr_space_t as, unw_word_t addr,
155 unw_word_t *val, int write, void *arg);
hp.com!davidm76166fb2002-04-05 23:37:55 +0000156
157 /* Access register number REG at address ADDR. */
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000158 int (*access_reg) (unw_addr_space_t as, unw_regnum_t reg,
159 unw_word_t *val, int write, void *arg);
hp.com!davidm76166fb2002-04-05 23:37:55 +0000160
161 /* Access register number REG at address ADDR. */
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000162 int (*access_fpreg) (unw_addr_space_t as, unw_regnum_t reg,
163 unw_fpreg_t *val, int write, void *arg);
hp.com!davidm76166fb2002-04-05 23:37:55 +0000164
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000165 int (*resume) (unw_addr_space_t as, unw_cursor_t *c, void *arg);
mostang.com!davidm73438412003-02-27 09:58:57 +0000166
167 /* Optional call back to obtain the name of a (static) procedure.
168 Dynamically generated procedures are handled automatically by
169 libunwind. This callback is optional and may be set to
170 NULL. */
171 int (*get_proc_name) (unw_addr_space_t as, unw_word_t addr,
172 char *buf, size_t buf_len, unw_word_t *offp,
173 void *arg);
hp.com!davidm76166fb2002-04-05 23:37:55 +0000174 }
175unw_accessors_t;
176
177typedef enum unw_save_loc_type
178 {
179 UNW_SLT_NONE, /* register is not saved ("not an l-value") */
180 UNW_SLT_MEMORY, /* register has been saved in memory */
181 UNW_SLT_REG /* register has been saved in (another) register */
182 }
183unw_save_loc_type_t;
184
185typedef struct unw_save_loc
186 {
187 unw_save_loc_type_t type;
188 union
189 {
190 unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */
191 unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */
192 }
193 u;
194 unw_tdep_save_loc_t extra; /* target-dependent additional information */
195 }
196unw_save_loc_t;
197
198/* These routines work both for local and remote unwinding. */
199
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000200extern unw_addr_space_t UNW_OBJ(local_addr_space);
201
mostang.com!davidmb6251b02002-12-12 09:17:41 +0000202extern unw_addr_space_t UNW_OBJ(create_addr_space) (unw_accessors_t *a,
203 int byte_order);
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000204extern void UNW_OBJ(destroy_addr_space) (unw_addr_space_t as);
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000205extern unw_accessors_t *UNW_ARCH_OBJ(get_accessors) (unw_addr_space_t as);
206extern void UNW_ARCH_OBJ(flush_cache)(unw_addr_space_t as,
207 unw_word_t lo, unw_word_t hi);
208extern int UNW_ARCH_OBJ(set_caching_policy)(unw_addr_space_t as,
209 unw_caching_policy_t policy);
mostang.com!davidmd5ad49b2003-03-13 02:15:01 +0000210extern const char *UNW_ARCH_OBJ(regname) (unw_regnum_t regnum);
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000211
mostang.com!davidma38baad2003-01-17 07:48:52 +0000212extern int UNW_OBJ(init_local) (unw_cursor_t *c, unw_context_t *u);
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000213extern int UNW_OBJ(init_remote) (unw_cursor_t *c, unw_addr_space_t as,
214 void *as_arg);
hp.com!davidm76166fb2002-04-05 23:37:55 +0000215extern int UNW_OBJ(step) (unw_cursor_t *c);
216extern int UNW_OBJ(resume) (unw_cursor_t *c);
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000217extern int UNW_OBJ(get_proc_info) (unw_cursor_t *c, unw_proc_info_t *pi);
hp.com!davidm75496742003-12-04 07:34:21 +0000218extern int UNW_OBJ(get_proc_info_by_ip) (unw_addr_space_t as, unw_word_t ip,
219 unw_proc_info_t *pi, void *as_arg);
hp.com!davidm76166fb2002-04-05 23:37:55 +0000220extern int UNW_OBJ(get_reg) (unw_cursor_t *c, int regnum, unw_word_t *valp);
221extern int UNW_OBJ(set_reg) (unw_cursor_t *c, int regnum, unw_word_t val);
222extern int UNW_OBJ(get_fpreg) (unw_cursor_t *c, int regnum, unw_fpreg_t *val);
223extern int UNW_OBJ(set_fpreg) (unw_cursor_t *c, int regnum, unw_fpreg_t val);
224extern int UNW_OBJ(get_save_loc) (unw_cursor_t *c, int regnum,
225 unw_save_loc_t *loc);
226extern int UNW_OBJ(is_signal_frame) (unw_cursor_t *c);
mostang.com!davidm981c8cc2003-02-08 10:10:59 +0000227extern int UNW_OBJ(get_proc_name) (unw_cursor_t *c, char *buf, size_t buf_len,
228 unw_word_t *offsetp);
hp.com!davidm76166fb2002-04-05 23:37:55 +0000229
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000230#define unw_local_addr_space UNW_OBJ(local_addr_space)
231
232/* Create a new address space (in addition to the default
mostang.com!davidmb6251b02002-12-12 09:17:41 +0000233 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>
mostang.com!davidma4bea2c2003-01-21 08:08:32 +0000235 (e.g., __LITTLE_ENDIAN or __BIG_ENDIAN). The default byte-order is
mostang.com!davidmb6251b02002-12-12 09:17:41 +0000236 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!davidm87bc2e32002-11-16 06:50:04 +0000239 This routine is NOT signal-safe. */
mostang.com!davidmb6251b02002-12-12 09:17:41 +0000240#define unw_create_addr_space(a,b) UNW_OBJ(create_addr_space)(a,b)
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000241
242/* Destroy an address space.
243 This routine is NOT signal-safe. */
244#define unw_destroy_addr_space(as) UNW_OBJ(destroy_addr_space)(as)
245
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000246/* Retrieve a pointer to the accessors structure associated with
247 address space AS.
248 This routine is signal-safe. */
249#define unw_get_accessors(as) UNW_ARCH_OBJ(get_accessors)(as)
250
hp.com!davidm76166fb2002-04-05 23:37:55 +0000251/* Initialize cursor C such that unwinding starts at the point
252 represented by the context U. Returns zero on success, negative
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000253 value on failure.
254 This routine is signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000255#define unw_init_local(c,u) UNW_OBJ(init_local)(c, u)
hp.com!davidm76166fb2002-04-05 23:37:55 +0000256
257/* Initialize cursor C such that it accesses the unwind target through
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000258 accessors A.
259 This routine is signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000260#define unw_init_remote(c,a,arg) UNW_OBJ(init_remote)(c, a, arg)
hp.com!davidm76166fb2002-04-05 23:37:55 +0000261
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!davidm87bc2e32002-11-16 06:50:04 +0000265 case of an error.
266 This routine is signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000267#define unw_step(c) UNW_OBJ(step)(c)
hp.com!davidm76166fb2002-04-05 23:37:55 +0000268
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000269/* Resume execution at the point identified by the cursor.
270 This routine is signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000271#define unw_resume(c) UNW_OBJ(resume)(c)
hp.com!davidm76166fb2002-04-05 23:37:55 +0000272
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000273/* Return the proc-info associated with the cursor.
274 This routine is signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000275#define unw_get_proc_info(c,p) UNW_OBJ(get_proc_info)(c,p)
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000276
hp.com!davidm75496742003-12-04 07:34:21 +0000277/* Return the proc-info associated instruction pointer IP or an
278 error-code if no such info can be found. Argument AS is the
279 address-space in which the instruction-pointer IP should be looked
280 up and PI is a pointer to the unw_proc_info_t structure that should
281 be used to return the info. ARG is an address-space-specific
282 argument and serves the same purpose as argument ARG for
283 unw_init_remote(). When AS is unw_local_addr_space, 0 must be
284 passed for this argument.
285
286 This routine is signal-safe. */
287#define unw_get_proc_info_by_ip(as,ip,pi,arg) \
288 UNW_OBJ(get_proc_info_by_ip)(as,ip,pi,arg)
289
hp.com!davidm76166fb2002-04-05 23:37:55 +0000290/* Register accessor routines. Return zero on success, negative value
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000291 on failure.
292 These routines are signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000293#define unw_get_reg(c,r,v) UNW_OBJ(get_reg)(c,r,v)
294#define unw_set_reg(c,r,v) UNW_OBJ(set_reg)(c,r,v)
hp.com!davidm76166fb2002-04-05 23:37:55 +0000295
296/* Floating-point accessor routines. Return zero on success, negative
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000297 value on failure.
298 These routines are signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000299#define unw_get_fpreg(c,r,v) UNW_OBJ(get_fpreg)(c,r,v)
300#define unw_set_fpreg(c,r,v) UNW_OBJ(set_fpreg)(c,r,v)
hp.com!davidm76166fb2002-04-05 23:37:55 +0000301
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000302/* Get the save-location of register R.
303 This routine is signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000304#define unw_get_save_loc(c,r,l) UNW_OBJ(get_save_loc)(c,r,l)
hp.com!davidm76166fb2002-04-05 23:37:55 +0000305
306/* Return 1 if register number R is a floating-point register, zero
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000307 otherwise.
308 This routine is signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000309#define unw_is_fpreg(r) unw_tdep_is_fpreg(r)
hp.com!davidm76166fb2002-04-05 23:37:55 +0000310
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000311/* Returns non-zero value if the cursor points to a signal frame.
312 This routine is signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000313#define unw_is_signal_frame(c) UNW_OBJ(is_signal_frame)(c)
mostang.com!davidm58142c02002-04-12 05:02:40 +0000314
mostang.com!davidmb6251b02002-12-12 09:17:41 +0000315/* Return the name of the procedure that created the frame identified
316 by the cursor. The returned string is ASCII NUL terminated. If the
317 string buffer is too small to store the entire name, the first
318 portion of the string that can fit is stored in the buffer (along
319 with a terminating NUL character) and -UNW_ENOMEM is returned. If
mostang.com!davidm981c8cc2003-02-08 10:10:59 +0000320 no name can be determined, -UNW_ENOINFO is returned.
321 This routine is NOT signal-safe. */
322#define unw_get_proc_name(c,s,l,o) UNW_OBJ(get_proc_name)(c, s, l, o)
mostang.com!davidmb6251b02002-12-12 09:17:41 +0000323
mostang.com!davidm58142c02002-04-12 05:02:40 +0000324/* Returns the canonical register name of register R. R must be in
325 the range from 0 to UNW_REG_LAST. Like all other unwind routines,
326 this one is re-entrant (i.e., the returned string must be a string
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000327 constant.
328 This routine is signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000329#define unw_regname(r) UNW_ARCH_OBJ(regname)(r)
mostang.com!davidm16f21892002-11-09 07:59:02 +0000330
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000331/* Sets the caching policy of address space AS. Caching can be
332 disabled completely by setting the policy to UNW_CACHE_NONE. With
333 UNW_CACHE_GLOBAL, there is a single cache that is shared across all
334 threads. With UNW_CACHE_PER_THREAD, each thread gets its own
335 cache, which can improve performance thanks to less locking and
336 better locality. By default, UNW_CACHE_GLOBAL is in effect.
337 This routine is NOT signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000338#define unw_set_caching_policy(as, p) UNW_ARCH_OBJ(set_caching_policy)(as, p)
mostang.com!davidm16f21892002-11-09 07:59:02 +0000339
340/* Flush all caches (global, per-thread, or any other caches that
mostang.com!davidm87bc2e32002-11-16 06:50:04 +0000341 might exist) in address-space AS of information at least relating
342 to the address-range LO to HI (non-inclusive). LO and HI are only
343 a performance hint and the function is allowed to over-flush (i.e.,
344 flush more than the requested address-range). Furthermore, if LO
345 and HI are both 0, the entire address-range is flushed. This
346 function must be called if any of unwind information might have
347 changed (e.g., because a library might have been removed via a call
mostang.com!davidm50d7a152002-12-03 08:19:58 +0000348 to dlclose()).
349 This routine is signal-safe. */
mostang.com!davidm20a6c1a2002-12-19 07:16:50 +0000350#define unw_flush_cache(as,lo,hi) UNW_ARCH_OBJ(flush_cache)(as, lo, hi)
hp.com!davidm68bdac32003-01-28 03:40:06 +0000351
352/* Helper routines which make it easy to use libunwind via ptrace().
353 They're available only if UNW_REMOTE is _not_ defined and they
354 aren't really part of the libunwind API. They are simple enough
355 not to warrant creating a separate library for them. */
356
357extern void *_UPT_create (pid_t);
358extern void _UPT_destroy (void *upt);
359extern int _UPT_find_proc_info (unw_addr_space_t as, unw_word_t ip,
360 unw_proc_info_t *pi, int need_unwind_info,
361 void *arg);
362extern void _UPT_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi,
363 void *arg);
364extern int _UPT_get_dyn_info_list_addr (unw_addr_space_t as,
365 unw_word_t *dil_addr, void *arg);
366extern int _UPT_access_mem (unw_addr_space_t as, unw_word_t addr,
367 unw_word_t *val, int write, void *arg);
368extern int _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg,
369 unw_word_t *val, int write, void *arg);
370extern int _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg,
371 unw_fpreg_t *val, int write, void *arg);
mostang.com!davidm73438412003-02-27 09:58:57 +0000372extern int _UPT_get_proc_name (unw_addr_space_t as, unw_word_t addr,
373 char *buf, size_t len, unw_word_t *offp,
374 void *arg);
mostang.com!davidmc670abb2003-03-06 06:14:36 +0000375extern int _UPT_resume (unw_addr_space_t as, unw_cursor_t *c, void *arg);
hp.com!davidm68bdac32003-01-28 03:40:06 +0000376extern unw_accessors_t _UPT_accessors;