ptrace - process trace
int ptrace(int request, int pid, int addr
Ptrace provides a means by which a parent process may con-
trol the execution of a child process, and examine and
change its core image. Its primary use is for the implemen-
tation of breakpoint debugging. A traced process runs until
a signal occurs. Then it stops and the parent will be noti-
fied with wait(2). When the process is in the stopped
state, its memory can be read and written. The parent can
also cause the child to continue execution, with optional
ignoring the signal which caused stopping.
The value of the request argument determines the precise
action of the system call:
This process is to be traced by its parent. The parent
should be expecting to trace the child.
Read word at location addr.
Read word at location addr in the USER area.
Write word at location addr.
Write word at location addr in the USER area.
Restart after signal.
Send the child a SIGKILL to make it exit.
Set the trap flag for single stepping.
Attach to the process specified in pid.
Detach a process that was previously attached.
init, the process with process ID 1, may not use this func-
On success, zero is returned. On error, -1 is returned, and
errno is set appropriately.
EPERM The specified process (i.e., init), cannot be
traced, or is already being traced.
ESRCH The specified process does not exist.
EIO Request is not valid.
SVr4, SVID EXT, AT&T, X/OPEN, BSD 4.3
gdb(1), exec(3), signal(2), wait(2)