Go to the previous, next section.

ptrace

SYNOPSIS

int ptrace(int request, int pid, int addr, int data);

PARAMETERS

request: [in] the kind of request.

pid: [in] target task.

addr: [in] the address where to perform peek and poke operations.

data: [in] the data to write for poke operations and [out] the data read for peek operations.

DESCRIPTION

This call is used for debugging a child of the current task. The traced child will run until a signal occurs. The parent is notified through the wait syscall. When the child is stoped the content of its address space may be read and written by the parent. The request parameter may be one of the following:

PTRACE_TRACEME
request tracing by the parent of the current task.

PTRACE_PEEKTEXT, PTRACE_PEEKDATA
request the reading of data from the address space of the child.

PTRACE_PEEKUSR
request the reading of data from the user area.

PTRACE_POKETEXT, PTRACE_POKEDATA
request the writing of data into the address space of the child.

PTRACE_POKEUSR
request the writing of data into the user area.

PTRACE_SYSCALL, PTRACE_CONT
request the continuation of the child after a signal.

PTRACE_KILL
send SIGKILL to the child.

PTRACE_SINGLESTEP
enable the single step mode.

PTRACE_ATTACH
attach to the process pid.

PTRACE_DETACH
detach from the process pid.

RETURN VALUE

On success zero is returned. On error -1 is returned and errno is set to one of the following values:

Go to the previous, next section.