HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)
u
uwx(3X) uwx(3X)
(Itanium(R)-based System Only)
UWX_REG_SP The stack pointer (SP).
UWX_REG_BSP The backing store pointer (BSP). This value defines the point in the backing
store where the current frame’s GR32 would be saved.
UWX_REG_CFM The current frame marker (CFM) and epilogue counter (AR.EC), combined
into one register as they are stored in AR.PFS.
UWX_REG_PREDS Predicate registers PR0-PR63. Only the preserved predicates have mean-
ingful values.
UWX_REG_PRIUNAT
The NaT bits for GR4-7 in the current frame.
UWX_REG_RNAT The RSE NaT collection register (AR.RNAT).
UWX_REG_UNAT The User NaT collection register (AR.UNAT).
UWX_REG_FPSR The floating-point status register (AR.FPSR).
UWX_REG_LC The loop counter register (AR.LC).
UWX_REG_GR(x) General register GRx. Only registers GR4-GR7 (the preserved GRs) and
GR32-GR127 (the stacked GRs) may be read.
UWX_REG_BR(x) Branch register BRx. Only registers BR1-BR5 (the preserved BRs) may be
read.
Using an Alternate Memory Allocator
The unwind express library tries to do as little memory allocation as possible, and under normal cir-
cumstances will allocate memory only during calls to
uwx_init() and uwx_self_init_info()
.
There are occasions, however, when additional memory is required during calls to
uwx_step().
To use an alternate memory allocator, the client should call
uwx_register_alloc_cb()
to register
alternate "allocate" and "free" callbacks. This routine must be called prior to any other calls to the
unwind express library, including calls to
uwx_init().
The function prototypes for these routines are identical to
malloc() and free(), respectively.
WRITING CALLBACK ROUTINES
The callback mechanism interfaces the unwind engine from the specific environment in which unwinding
is taking place. This mechanism consists of a "token" and two callback routines. The token is an arbi-
trary pointer-sized value that is provided by the client, and passed to the callback routines when they are
called by the unwind engine. The first callback routine is called by the unwind engine to lookup an
Instruction Pointer (IP) and find the load module associated with that IP. The second callback routine is
called to read data from the memory space of the process being unwound.
The Callback Token
The token, declared as type
intptr_t, is typically a pointer to a callback information structure defined
by and provided by the client. This structure contains information that the client needs to share with the
callback routines it provides. The structure may also provide a storage area where the callback routines
can maintain cached information.
For a "cross-unwind," the callback information structure needs to contain information about the target
process (e.g., thread or process id), along with some address space mapping information.
The callback information structure also needs to contain a copy of or a reference to the initial context
from which the unwind was initiated. The unwind environment itself tracks only the state of preserved
registers and the key stack marker values (IP, SP, BSP, CFM); if execution stops in a leaf function or
early in a function prologue, some important values may exist in scratch registers (e.g., the return
pointer, RP, may still be in BR0). When the unwind engine determines that it needs the value from a
register that it doesn’t already have, it uses the "Copy-in" callback to obtain that value.
The Lookup IP callback
The "Lookup IP" callback is used for obtaining information for a given IP. Its prototype is given in
<uwx.h> as follows:
typedef int (*lookupip_cb)(
int request,
uint64_t ip,
intptr_t tok,
Section 3−−1140 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: September 2004