HP-UX Reference (11i v2 04/09) - 2 System Calls (vol 5)
p
ptrace(2) ptrace(2)
(PA Only; TO BE OBSOLETED)
is logged in the parent’s context and the parent’s pid argument value is logged
in the child’s context. The child does not inherit its parent’s event flags. See
the ptrace_state structure description under
PT_GET_PROCESS_STATE
for
further details.
PTRACE_VFORK This event flag indicates that the traced process needs to take special action
when it invokes
vfork(). When set, the child process stops after marking
itself as a traced process and adopting its parent’s debugger. The fact that a
PTRACE_VFORK event was handled is logged in the context of both the parent
and child processes. Further, the child’s pid argument value is logged in the
parent’s context and the parent’s pid argument value is logged in the child’s
context. The child does not inherit its parent’s event flags. See the
ptrace_state structure description under
PT_GET_PROCESS_STATE
for
further details.
It is important to note that the warnings with respect to
vfork() (see
vfork (2)), continue to apply here. 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 is done to either
exec*() or exit(), or it exits 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 description 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
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 writ-
ing the contents of the ptrace_event data structure in the user space pointed to
by the addr argument into the context of the traced process. The data argu-
ment 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 results in
errno being set to
[EIO]. The typedef for the ptrace_event data structure is shown below:
typedef struct ptrace_event{
sigset_t pe_signals;
events_t pe_set_event;
char pe_spare[28];
} ptrace_event_t;
Event flags are set in the pe_set_event member of the ptrace_event data struc-
ture. 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 struc-
ture. This member is activated 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 that the
traced process received; that is, these are signals received by the traced pro-
cess 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>.
Section 2−−268 Hewlett-Packard Company − 4 − HP-UX 11i Version 2: September 2004