HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)

u
uwx(3X) uwx(3X)
(Itanium(R)-based System Only)
1. Call uwx_init()
to create a new unwind environment. The return value is a pointer to the
unwind environment.
2. Call
uwx_self_init_info()
to initialize the standard callback environment. The return
value is a pointer to the callback info structure.
3. Call
uwx_register_callbacks()
to register the standard callbacks:
uwx_self_copyin()
and uwx_self_lookupip()
.
The steps above may be performed at any time in advance of performing a stack unwind. The resulting
unwind environment can then be used repeatedly.
To perform a stack unwind from some point in the application, the client must perform the following
steps:
1. Call
uwx_self_init_context()
to provide the current threads context as a starting point
for unwinding. The stack frame for the caller of this function becomes the current frame.
2. Call
uwx_step() to step back one frame in the call stack. After each step, the new frame
becomes the current frame, and the client may call
uwx_get_reg() to obtain values from the
reconstructed context for the new frame. This step can be repeated until the process reaches the
bottom of the stack or a signal context frame.
3. When a signal context frame is reached, the client may call
uwx_self_do_context_frame()
to provide a new starting point for unwinding based on
the context at the point of interruption. The stack frame for the function interrupted by the sig-
nal becomes the current frame. Subsequent calls to
uwx_step() will proceed from there.
Cross-Unwinding
To prepare for cross-unwinding, a client application must perform the following steps to create and ini-
tialize a new unwind environment:
1. Call uwx_init() to create a new unwind environment. The return value is a pointer to the
unwind environment.
2. Call
uwx_set_remote()
to setup the unwind environment for cross unwinding. This call also
allows the client to specify the byte order (little-endian or big-endian) of the target process.
3. Call
uwx_register_callbacks()
to register the client-provided callback functions. See the
section WRITING CALLBACK ROUTINES below for more information.
The steps above may be performed at any time in advance of performing a stack unwind. The resulting
unwind environment can then be used repeatedly.
To perform a stack unwind, the client must perform the following steps:
1. Call
uwx_init_context()
to provide the basic initial context as a starting point for unwind-
ing. This initial context consists of the values of IP (instruction pointer), SP (stack pointer), BSP
(backing store pointer), and CFM (current frame marker). The frame described by these values
becomes the current frame. If the unwind engine needs values from additional registers in the
target thread’s context, it will request them as needed through the callback interface.
2. Call
uwx_step() to step back one frame in the call stack. After each step, the new frame
becomes the current frame, and the client may call uwx_get_reg() to obtain values from the
reconstructed context for the new frame. This step can be repeated until the process reaches the
bottom of the stack or a signal context frame.
3. When a signal context frame is reached, the client may call
uwx_get_abi_context_code()
to obtain the abi and context parameters recorded in the unwind descriptors for the frame. This
routine returns the two values in a single int as ((abi << 8) | context ). It should then call
uwx_init_context() again to provide a new starting point for unwinding based on the con-
text at the point of interruption. The stack frame for the function interrupted by the signal
becomes the current frame. Subsequent calls to uwx_step() will proceed from there.
Obtaining Information From the Current Frame’s Context
Registers from the current frame may be read using
uwx_get_reg(). The following are the supported
values for the regid parameter:
UWX_REG_IP The instruction pointer (IP).
HP-UX 11i Version 2: September 2004 2 Hewlett-Packard Company Section 31139