Files
oldlinux-files/Ref-docs/syscalls/syscalls_96.html
2024-02-19 00:21:47 -05:00

76 lines
2.7 KiB
HTML

<html><!-- This HTML file has been created by texi2html 1.29
from syscalls.texi on 4 June 1994 -->
<TITLE>Syscall specifications of Linux - ptrace</TITLE>
<P>Go to the <A HREF="syscalls_95.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_95.html">previous</A>, <A HREF="syscalls_97.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_97.html">next</A> section.<P>
<H2><A NAME="SEC96" HREF="syscalls_toc.html#SEC96" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC96">ptrace</A></H2>
<P>
<H3>SYNOPSIS</H3>
<P>
<CODE>int ptrace(int <VAR>request</VAR>, int <VAR>pid</VAR>, int <VAR>addr</VAR>, int
<VAR>data</VAR>);</CODE>
<H3>PARAMETERS</H3>
<P>
<VAR>request</VAR>: [in] the kind of request.
<P>
<VAR>pid</VAR>: [in] target task.
<P>
<VAR>addr</VAR>: [in] the address where to perform peek and poke operations.
<P>
<VAR>data</VAR>: [in] the data to write for poke operations and [out] the
data read for peek operations.
<P>
<H3>DESCRIPTION</H3>
<P>
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
<CODE>wait</CODE> syscall. When the child is stoped the content of its
address space may be read and written by the parent. The <VAR>request</VAR>
parameter may be one of the following:
<P>
<DL COMPACT>
<DT><CODE>PTRACE_TRACEME</CODE>
<DD>request tracing by the parent of the current task.
<P>
<DT><CODE>PTRACE_PEEKTEXT, PTRACE_PEEKDATA</CODE>
<DD>request the reading of data from the address space of the child.
<P>
<DT><CODE>PTRACE_PEEKUSR</CODE>
<DD>request the reading of data from the user area.
<P>
<DT><CODE>PTRACE_POKETEXT, PTRACE_POKEDATA</CODE>
<DD>request the writing of data into the address space of the child.
<P>
<DT><CODE>PTRACE_POKEUSR</CODE>
<DD>request the writing of data into the user area.
<P>
<DT><CODE>PTRACE_SYSCALL, PTRACE_CONT</CODE>
<DD>request the continuation of the child after a signal.
<P>
<DT><CODE>PTRACE_KILL</CODE>
<DD>send <CODE>SIGKILL</CODE> to the child.
<P>
<DT><CODE>PTRACE_SINGLESTEP</CODE>
<DD>enable the single step mode.
<P>
<DT><CODE>PTRACE_ATTACH</CODE>
<DD>attach to the process <VAR>pid</VAR>.
<P>
<DT><CODE>PTRACE_DETACH</CODE>
<DD>detach from the process <VAR>pid</VAR>.
</DL>
<P>
<H3>RETURN VALUE</H3>
<P>
On success zero is returned. On error -1 is returned and <CODE>errno</CODE> is
set to one of the following values:
<P>
<UL>
<LI><CODE>EPERM</CODE>: the target taks cannot be traced or is already
being traced.
<LI><CODE>ESRCH</CODE>, <CODE>EIO</CODE>.
</UL>
<P>
<P>Go to the <A HREF="syscalls_95.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_95.html">previous</A>, <A HREF="syscalls_97.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_97.html">next</A> section.<P>