1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-26 09:07:38 +01:00

Document which routines are signal-safe.

(unw_addr_space_t): New type.
(unw_accessors_t): Remove "arg" member.
(unw_local_addr_space): New variable.
(unw_create_addr_space): New function.
(unw_destroy_addr_space): Ditto.
(unw_init_remote): Take address-space and accessor-argument pointer instead of
	accessor structure as argument.
(unw_set_caching_policy): Take address-space as first argument.
(unw_flush_cache): Take address space and address-range (lo & hi) arguments.

(Logical change 1.27)
This commit is contained in:
mostang.com!davidm 2002-11-16 06:50:04 +00:00
parent 5287e145c3
commit 87bc2e3242

View file

@ -118,6 +118,8 @@ typedef union
} }
unw_fpreg_t; unw_fpreg_t;
typedef struct unw_addr_space *unw_addr_space_t;
/* These are backend callback routines that provide access to the /* These are backend callback routines that provide access to the
state of a "remote" process. This can be used, for example, to state of a "remote" process. This can be used, for example, to
unwind another process through the ptrace() interface. */ unwind another process through the ptrace() interface. */
@ -140,8 +142,6 @@ typedef struct unw_accessors
void *arg); void *arg);
int (*resume) (unw_cursor_t *c, void *arg); int (*resume) (unw_cursor_t *c, void *arg);
void *arg; /* application-specific data */
} }
unw_accessors_t; unw_accessors_t;
@ -168,8 +168,13 @@ unw_save_loc_t;
/* These routines work both for local and remote unwinding. */ /* These routines work both for local and remote unwinding. */
extern unw_addr_space_t UNW_OBJ(local_addr_space);
extern unw_addr_space_t UNW_OBJ(create_addr_space) (unw_accessors_t *a);
extern void UNW_OBJ(destroy_addr_space) (unw_addr_space_t as);
extern int UNW_OBJ(init_local) (unw_cursor_t *c, ucontext_t *u); extern int UNW_OBJ(init_local) (unw_cursor_t *c, ucontext_t *u);
extern int UNW_OBJ(init_remote) (unw_cursor_t *c, unw_accessors_t *a); extern int UNW_OBJ(init_remote) (unw_cursor_t *c, unw_addr_space_t as,
void *as_arg);
extern int UNW_OBJ(step) (unw_cursor_t *c); extern int UNW_OBJ(step) (unw_cursor_t *c);
extern int UNW_OBJ(resume) (unw_cursor_t *c); extern int UNW_OBJ(resume) (unw_cursor_t *c);
extern int UNW_OBJ(get_reg) (unw_cursor_t *c, int regnum, unw_word_t *valp); extern int UNW_OBJ(get_reg) (unw_cursor_t *c, int regnum, unw_word_t *valp);
@ -181,59 +186,87 @@ extern int UNW_OBJ(get_save_loc) (unw_cursor_t *c, int regnum,
extern int UNW_OBJ(is_signal_frame) (unw_cursor_t *c); extern int UNW_OBJ(is_signal_frame) (unw_cursor_t *c);
extern const char *UNW_OBJ(regname) (int regnum); extern const char *UNW_OBJ(regname) (int regnum);
#define unw_local_addr_space UNW_OBJ(local_addr_space)
/* Create a new address space (in addition to the default
local_addr_space).
This routine is NOT signal-safe. */
#define unw_create_addr_space(a) UNW_OBJ(create_addr_space)(a)
/* Destroy an address space.
This routine is NOT signal-safe. */
#define unw_destroy_addr_space(as) UNW_OBJ(destroy_addr_space)(as)
/* Initialize cursor C such that unwinding starts at the point /* Initialize cursor C such that unwinding starts at the point
represented by the context U. Returns zero on success, negative represented by the context U. Returns zero on success, negative
value on failure. */ value on failure.
This routine is signal-safe. */
#define unw_init_local(c,u) UNW_OBJ(init_local)(c, u) #define unw_init_local(c,u) UNW_OBJ(init_local)(c, u)
/* Initialize cursor C such that it accesses the unwind target through /* Initialize cursor C such that it accesses the unwind target through
accessors A. */ accessors A.
#define unw_init_remote(c,a) UNW_OBJ(init_remote)(c, a) This routine is signal-safe. */
#define unw_init_remote(c,a,arg) UNW_OBJ(init_remote)(c, a, arg)
/* Move cursor up by one step (up meaning toward earlier, less deeply /* Move cursor up by one step (up meaning toward earlier, less deeply
nested frames). Returns positive number if there are more frames nested frames). Returns positive number if there are more frames
to unwind, 0 if last frame has been reached, negative number in to unwind, 0 if last frame has been reached, negative number in
case of an error. */ case of an error.
This routine is signal-safe. */
#define unw_step(c) UNW_OBJ(step)(c) #define unw_step(c) UNW_OBJ(step)(c)
/* Resume execution at the point identified by the cursor. */ /* Resume execution at the point identified by the cursor.
This routine is signal-safe. */
#define unw_resume(c) UNW_OBJ(resume)(c) #define unw_resume(c) UNW_OBJ(resume)(c)
/* Register accessor routines. Return zero on success, negative value /* Register accessor routines. Return zero on success, negative value
on failure. */ on failure.
These routines are signal-safe. */
#define unw_get_reg(c,r,v) UNW_OBJ(get_reg)(c,r,v) #define unw_get_reg(c,r,v) UNW_OBJ(get_reg)(c,r,v)
#define unw_set_reg(c,r,v) UNW_OBJ(set_reg)(c,r,v) #define unw_set_reg(c,r,v) UNW_OBJ(set_reg)(c,r,v)
/* Floating-point accessor routines. Return zero on success, negative /* Floating-point accessor routines. Return zero on success, negative
value on failure. */ value on failure.
These routines are signal-safe. */
#define unw_get_fpreg(c,r,v) UNW_OBJ(get_fpreg)(c,r,v) #define unw_get_fpreg(c,r,v) UNW_OBJ(get_fpreg)(c,r,v)
#define unw_set_fpreg(c,r,v) UNW_OBJ(set_fpreg)(c,r,v) #define unw_set_fpreg(c,r,v) UNW_OBJ(set_fpreg)(c,r,v)
/* Get the save-location of register R.
This routine is signal-safe. */
#define unw_get_save_loc(c,r,l) UNW_OBJ(get_save_loc)(c,r,l) #define unw_get_save_loc(c,r,l) UNW_OBJ(get_save_loc)(c,r,l)
/* Return 1 if register number R is a floating-point register, zero /* Return 1 if register number R is a floating-point register, zero
otherwise. */ otherwise.
This routine is signal-safe. */
#define unw_is_fpreg(r) unw_tdep_is_fpreg(r) #define unw_is_fpreg(r) unw_tdep_is_fpreg(r)
/* Returns non-zero value if the cursor points to a signal frame. */ /* Returns non-zero value if the cursor points to a signal frame.
This routine is signal-safe. */
#define unw_is_signal_frame(c) UNW_OBJ(is_signal_frame)(c) #define unw_is_signal_frame(c) UNW_OBJ(is_signal_frame)(c)
/* Returns the canonical register name of register R. R must be in /* Returns the canonical register name of register R. R must be in
the range from 0 to UNW_REG_LAST. Like all other unwind routines, the range from 0 to UNW_REG_LAST. Like all other unwind routines,
this one is re-entrant (i.e., the returned string must be a string this one is re-entrant (i.e., the returned string must be a string
constant. */ constant.
This routine is signal-safe. */
#define unw_regname(r) UNW_OBJ(regname)(r) #define unw_regname(r) UNW_OBJ(regname)(r)
/* Sets the caching policy. Caching can be disabled completely by /* Sets the caching policy of address space AS. Caching can be
setting the policy to UNW_CACHE_NONE. With UNW_CACHE_GLOBAL, there disabled completely by setting the policy to UNW_CACHE_NONE. With
is a single cache that is shared across all threads. With UNW_CACHE_GLOBAL, there is a single cache that is shared across all
UNW_CACHE_PER_THREAD, each thread gets its own cache, which can threads. With UNW_CACHE_PER_THREAD, each thread gets its own
improve performance thanks to less locking and better locality. By cache, which can improve performance thanks to less locking and
default, UNW_CACHE_GLOBAL is in effect. */ better locality. By default, UNW_CACHE_GLOBAL is in effect.
#define unw_set_caching_policy(p) UNW_OBJ(set_caching_policy)(p) This routine is NOT signal-safe. */
#define unw_set_caching_policy(as, p) UNW_OBJ(set_caching_policy)(as, p)
/* Flush all caches (global, per-thread, or any other caches that /* Flush all caches (global, per-thread, or any other caches that
might exist). This function must be called if any of unwind might exist) in address-space AS of information at least relating
information might have changed (e.g., because a library might have to the address-range LO to HI (non-inclusive). LO and HI are only
been removed via a call to dlclose()). */ a performance hint and the function is allowed to over-flush (i.e.,
#define unw_flush_cache() UNW_OBJ(flush_cache)() flush more than the requested address-range). Furthermore, if LO
and HI are both 0, the entire address-range is flushed. This
function must be called if any of unwind information might have
changed (e.g., because a library might have been removed via a call
to dlclose()). This routine is signal-safe. */
#define unw_flush_cache(as,lo,hi) UNW_OBJ(flush_cache)(as, lo, hi)