HP-UX Reference (11i v1 05/09) - 2 System Calls (vol 5)

p
ptrace(2) ptrace(2)
This request fails if addr is not the start address of a word or is outside the user area,
in which case a value of 1 is returned to the tracing process and its
errno is set to
[EIO].
PT_WDUSER
PT_WIUSER
With these requests, the value given by the data argument is written into the address
space of the traced process at location addr.
PT_WIUSER writes a word into I space,
and
PT_WDUSER writes a word in D space. Upon successful completion, the value
written into the address space of the traced process is returned to the tracing process.
The addr2 argument is ignored.
These two requests fail if addr is not the start address of a word, or if addr is a loca-
tion in a pure procedure space and either another process is executing in that space or
the tracing process does not have write access for the executable file corresponding to
that space. Upon failure, a value of 1 is returned to the tracing process and its
errno is set to [EIO].
PT_WUAREA This request is not supported. Therefore, it returns 1, sets
errno to [EIO] and does
not affect the user area of the traced process.
PT_RUREGS With this request, the word at location addr in the save_state structure at the
base of the per-process kernel stack is returned to the tracing process. addr must be
word-aligned and less than STACKSIZE*NBPG
(see <sys/param.h> and
<machine/param.h>
). The save_state structure contains the registers and
other information about the process. The data and addr2 arguments are ignored.
PT_WUREGS The save_state structure at the base of the per-process kernel stack is written as
it is read with request PT_RUREGS . Only a few locations can be written in this way:
the general registers, most floating-point registers, a few control registers, and certain
bits of the interruption processor status word. The addr2 argument is ignored.
PT_RDDATA
PT_RDTEXT
These requests are identical to PT_RDUSER and PT_RIUSER , except that the data
argument specifies the number of bytes to read and the addr2 argument specifies
where to store that data in the tracing process.
PT_WRDATA
PT_WRTEXT
These requests are identical to PT_WDUSER and PT_WIUSER , except that the data
argument specifies the number of bytes to write and the addr2 argument specifies
where to read that data in the tracing process.
PT_CONTIN This request causes the traced process to resume execution. If the data argument is
0, all pending signals, including the one that caused the traced process to stop, are
canceled before it resumes execution. If the data argument is a valid signal number,
the traced process resumes execution as if it had incurred that signal, and any other
pending signals are canceled. The addr2 argument is ignored.
If the addr argument is not 1, the Instruction Address Offset Queue (program
counter) is loaded with the values addr and addr+4 before execution resumes. Other-
wise, execution resumes from the point where it was interrupted.
Upon successful completion, the value of data is returned to the tracing process.
This request fails if data is not 0 or a valid signal number, in which case a value of 1
is returned to the tracing process and its errno is set to [EIO].
PT_EXIT This request causes the traced process to terminate with the same consequences as
exit(). The addr, data, and addr2 arguments are ignored.
PT_SINGLE This request causes a flag to be set so that an interrupt occurs upon the completion of
one machine instruction. It then executes the same steps as listed above for request
PT_CONTIN. If the processor does not provide a trace bit, this request returns an
error. This effectively allows single-stepping of the traced process.
Whether or not the trace bit remains set after this interrupt is a function of the
hardware.
PT_ATTACH This request stops the process identified by pid and allows the calling process to trace
it. Process pid does not have to be a child of the calling process, but the effective user
ID of the calling process must match the real and saved user ID of process pid unless
HP-UX 11i Version 1: September 2005 2 Hewlett-Packard Company Section 2255