HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
p
ptrace(2) ptrace(2)
details. It is important to note that the warnings with respect to vfork() (see
vfork(2)), continue to apply here. In particular, it needs to be remembered that, when
the child process stops, its parent process is suspended, and that the child borrows the
parent’s memory and thread of control until a call to exec*() or an exit (either by a
call to exit() or abnormally (see exec(2) and exit(2))).
PTRACE_EXEC
This event flag indicates that the traced process needs to take special action when it
invokes exec*(). When set, the traced process stops after logging the fact that it
stopped in response to a PTRACE_EXEC event. It also logs information pertaining to
the path or file argument of exec*(). This includes a pointer to the path name
string and the length of the path name string. See the ptrace_state structure descrip-
tion under PT_GET_PROCESS_STATE for further details.
PTRACE_EXIT
This event flag indicates that the traced process needs to take special action when it
invokes exit(). When set, the traced process stops after logging the fact that it
stopped in response to a PTRACE_EXIT event.
PT_SET_EVENT_MASK
This request is used by the calling process to specify event flags and signal mask
values that it wants the traced process to respond to. It does so by writing the con-
tents of the ptrace_event data structure in the user space pointed to by addr into the
context of the traced process. The data argument specifies the number of bytes to be
transferred. The addr2 argument is ignored.
The request fails if the number of bytes specified is less than zero or greater than the
size of the ptrace_event structure, and its
errno is set to [EIO].
typedef struct ptrace_event{
sigset_t pe_signals;
events_t pe_set_event;
} ptrace_event_t;
Event flags are set in the pe_set_event member of the ptrace_event data structure. An
event flag is set when the tracing process wants the traced process to respond to a
particular event. As detailed earlier, the event flags defined are PTRACE_EXEC ,
PTRACE_EXIT , PTRACE_FORK , PTRACE_SIGNAL, and
PTRACE_VFORK . See
the definition of events_t in
<sys/ptrace.h>
for more details.
Signal mask values are set in the pe_signals member of the ptrace_event structure.
This field is qualified by a
PTRACE_SIGNAL
event flag being set in the pe_set_event
member. Mask values set in the pe_signals member correspond to signals that need
to be masked from the tracing process when received by the traced process; that is,
these are signals received by the traced process that the tracing process does not want
to be informed about. The pe_signals member is described by the type definition
sigset_t, which is defined in
<signal.h>.
PT_GET_EVENT_MASK
This request is used by the calling process to determine the event flags and signal
mask values that have been set in the traced process’s context by the last
PT_SET_EVENT_MASK
request. The data argument specifies the number bytes to
be read from the context of the traced process into the ptrace_event data structure in
user space pointed to by addr . The addr2 argument is ignored.
The request fails if the number of bytes requested is less than zero or greater than the
size of the ptrace_event structure, and its
errno is set to [EIO].
PT_GET_PROCESS_STATE
This request is used by the calling process to access state information logged by the
traced process after it (the traced process) has responded to an event. The request
reads data bytes of data from the traced process’s context into the ptrace_state data
structure in user space pointed to by addr . The addr2 argument is ignored.
The ptrace_state data structure is described in <sys/ptrace.h>
and has the fol-
lowing members:
HP-UX Release 11i: December 2000 − 4 − Section 2−−237
___
___