Back to index

glibc  2.9
ptrace.h
Go to the documentation of this file.
00001 /* `ptrace' debugger support interface.  Generic version; constants are common.
00002    Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef       _PTRACE_H
00021 
00022 #define       _PTRACE_H     1
00023 #include <features.h>
00024 
00025 __BEGIN_DECLS
00026 
00027 
00028 /* Type of the REQUEST argument to `ptrace.'  */
00029 enum __ptrace_request
00030 {
00031   /* Indicate that the process making this request should be traced.
00032      All signals received by this process can be intercepted by its
00033      parent, and its parent can use the other `ptrace' requests.  */
00034   PTRACE_TRACEME = 0,
00035 #define PT_TRACE_ME PTRACE_TRACEME
00036 
00037   /* Return the word in the process's text space at address ADDR.  */
00038   PTRACE_PEEKTEXT,
00039 #define PT_READ_I PTRACE_PEEKTEXT
00040 
00041   /* Return the word in the process's data space at address ADDR.  */
00042   PTRACE_PEEKDATA,
00043 #define PT_READ_D PTRACE_PEEKDATA
00044 
00045   /* Return the word in the process's user area at offset ADDR.  */
00046   PTRACE_PEEKUSER,
00047 #define PT_READ_U PTRACE_PEEKUSER
00048 
00049   /* Write the word DATA into the process's text space at address ADDR.  */
00050   PTRACE_POKETEXT,
00051 #define PT_WRITE_I PTRACE_POKETEXT
00052 
00053   /* Write the word DATA into the process's data space at address ADDR.  */
00054   PTRACE_POKEDATA,
00055 #define PT_WRITE_D PTRACE_POKEDATA
00056 
00057   /* Write the word DATA into the process's user space at offset ADDR.  */
00058   PTRACE_POKEUSER,
00059 #define PT_WRITE_U PTRACE_POKEUSER
00060 
00061   /* Continue the process.  */
00062   PTRACE_CONT,
00063 #define PT_CONTINUE PTRACE_CONT
00064 
00065   /* Kill the process.  */
00066   PTRACE_KILL,
00067 #define PT_KILL PTRACE_KILL
00068 
00069   /* Single step the process.
00070      This is not supported on all machines.  */
00071   PTRACE_SINGLESTEP,
00072 #define PT_STEP PTRACE_SINGLESTEP
00073 
00074   /* Attach to a process that is already running. */
00075   PTRACE_ATTACH,
00076 #define PT_ATTACH PTRACE_ATTACH
00077 
00078   /* Detach from a process attached to with PTRACE_ATTACH.  */
00079   PTRACE_DETACH,
00080 #define PT_DETACH PTRACE_DETACH
00081 
00082   /* Get the process's registers (not including floating-point registers)
00083      and put them in the `struct regs' (see <machine/regs.h>) at ADDR.  */
00084   PTRACE_GETREGS = 12,
00085 
00086   /* Set the process's registers (not including floating-point registers)
00087      to the contents of the `struct regs' (see <machine/regs.h>) at ADDR.  */
00088   PTRACE_SETREGS,
00089 
00090   /* Get the process's floating point registers and put them
00091      in the `struct fp_status' (see <machine/regs.h>) at ADDR.  */
00092   PTRACE_GETFPREGS = 14,
00093 
00094   /* Set the process's floating point registers to the contents
00095      of the `struct fp_status' (see <machine/regs.h>) at ADDR.  */
00096   PTRACE_SETFPREGS,
00097 
00098   /* Read DATA bytes from the process's data space at address ADDR.
00099      Put the result starting at address ADDR2 in the caller's
00100      address space.  */
00101   PTRACE_READDATA = 16,
00102 
00103   /* Write DATA bytes from ADDR2 in the caller's address space into
00104      the process's data space at address ADDR.  */
00105   PTRACE_WRITEDATA,
00106 
00107   /* Read DATA bytes from the process's text space at address ADDR.
00108      Put the result starting at address ADDR2 in the caller's
00109      address space.  */
00110   PTRACE_READTEXT = 18,
00111 
00112   /* Write DATA bytes from ADDR2 in the caller's address space into
00113      the process's text space at address ADDR.  */
00114   PTRACE_WRITETEXT,
00115 
00116   /* Read the floating-point accelerator unit registers and
00117      put them into the `struct fpa_regs' (see <machine/regs.h>) at ADDR.  */
00118   PTRACE_GETFPAREGS = 20,
00119 
00120   /* Write the floating-point accelerator unit registers from
00121      the contents of the `struct fpa_regs' at ADDR.  */
00122   PTRACE_SETFPAREGS
00123 };
00124 
00125 /* Perform process tracing functions.  REQUEST is one of the values
00126    above, and determines the action to be taken.
00127    For all requests except PTRACE_TRACEME, PID specifies the process to be
00128    traced.
00129 
00130    PID and the other arguments described above for the various requests should
00131    appear (those that are used for the particular request) as:
00132      pid_t PID, void *ADDR, int DATA, void *ADDR2
00133    after REQUEST.  */
00134 extern int ptrace (enum __ptrace_request __request, ...);
00135 
00136 __END_DECLS
00137 
00138 #endif /* ptrace.h */