HP-UX Reference (11i v3 07/02) - 3 Library Functions N-Z (vol 7)

u
uwx(3X) uwx(3X)
(Integrity Systems Only)
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
uwx_register_callbacks(3X) for information on writing callback routines.
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 unwinding.
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 con-
text, 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 context
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()
and uwx_get_nat().
The starting address of the current function may be obtained by calling
uwx_get_funcstart()
.
Symbolic information may be obtained, if available, for the current frame’s IP by calling
uwx_get_module_info()
, uwx_get_sym_info(), and uwx_get_source_info()
.
ERRORS
For the APIs that return pointer values, a NULL pointer indicates a memory allocation error; otherwise a
pointer to an opaque object is returned.
For other APIs, an integer status code is returned. These codes are listed here.
[UWX_OK] Request successfully completed.
[UWX_ABI_FRAME]
uwx_step() hit a signal context frame.
[UWX_BOTTOM]
uwx_step() hit bottom of stack.
[UWX_ERR_BADCACHE] The cached information returned by the lookup-ip callback was
invalid.
[UWX_ERR_BADKEY] The "Lookup IP" callback returned an invalid key in the result vector.
[UWX_ERR_BADREGID] The register id is invalid.
[UWX_ERR_BADUDESC] The unwind information block contains an invalid descriptor.
[UWX_ERR_CANTUNWIND] The unwind engine is unable to unwind from the current frame
because of an unsupported descriptor.
[UWX_ERR_COPYIN_MSTK] There was an error reading a value from the memory stack.
[UWX_ERR_COPYIN_REG] There was an error reading a register from the initial context.
[UWX_ERR_COPYIN_RSTK] There was an error reading a value from the register stack backing
store.
[UWX_ERR_COPYIN_UINFO] There was an error reading the unwind information block.
[UWX_ERR_COPYIN_UTBL] There was an error reading the unwind table.
[UWX_ERR_IPNOTFOUND] No module information was found for the current frame’s IP.
600 Hewlett-Packard Company 2 HP-UX 11i Version 3: February 2007