chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.git] / sysdeps / generic / sys / ptrace.h
1 /* `ptrace' debugger support interface.  Generic version; constants are common.
2    Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19
20 #ifndef _PTRACE_H
21
22 #define _PTRACE_H       1
23 #include <features.h>
24
25 __BEGIN_DECLS
26
27
28 /* Type of the REQUEST argument to `ptrace.'  */
29 enum __ptrace_request
30 {
31   /* Indicate that the process making this request should be traced.
32      All signals received by this process can be intercepted by its
33      parent, and its parent can use the other `ptrace' requests.  */
34   PTRACE_TRACEME = 0,
35 #define PT_TRACE_ME PTRACE_TRACEME
36
37   /* Return the word in the process's text space at address ADDR.  */
38   PTRACE_PEEKTEXT,
39 #define PT_READ_I PTRACE_PEEKTEXT
40
41   /* Return the word in the process's data space at address ADDR.  */
42   PTRACE_PEEKDATA,
43 #define PT_READ_D PTRACE_PEEKDATA
44
45   /* Return the word in the process's user area at offset ADDR.  */
46   PTRACE_PEEKUSER,
47 #define PT_READ_U PTRACE_PEEKUSER
48
49   /* Write the word DATA into the process's text space at address ADDR.  */
50   PTRACE_POKETEXT,
51 #define PT_WRITE_I PTRACE_POKETEXT
52
53   /* Write the word DATA into the process's data space at address ADDR.  */
54   PTRACE_POKEDATA,
55 #define PT_WRITE_D PTRACE_POKEDATA
56
57   /* Write the word DATA into the process's user space at offset ADDR.  */
58   PTRACE_POKEUSER,
59 #define PT_WRITE_U PTRACE_POKEUSER
60
61   /* Continue the process.  */
62   PTRACE_CONT,
63 #define PT_CONTINUE PTRACE_CONT
64
65   /* Kill the process.  */
66   PTRACE_KILL,
67 #define PT_KILL PTRACE_KILL
68
69   /* Single step the process.
70      This is not supported on all machines.  */
71   PTRACE_SINGLESTEP,
72 #define PT_STEP PTRACE_SINGLESTEP
73
74   /* Attach to a process that is already running. */
75   PTRACE_ATTACH,
76 #define PT_ATTACH PTRACE_ATTACH
77
78   /* Detach from a process attached to with PTRACE_ATTACH.  */
79   PTRACE_DETACH,
80 #define PT_DETACH PTRACE_DETACH
81
82   /* Get the process's registers (not including floating-point registers)
83      and put them in the `struct regs' (see <machine/regs.h>) at ADDR.  */
84   PTRACE_GETREGS = 12,
85
86   /* Set the process's registers (not including floating-point registers)
87      to the contents of the `struct regs' (see <machine/regs.h>) at ADDR.  */
88   PTRACE_SETREGS,
89
90   /* Get the process's floating point registers and put them
91      in the `struct fp_status' (see <machine/regs.h>) at ADDR.  */
92   PTRACE_GETFPREGS = 14,
93
94   /* Set the process's floating point registers to the contents
95      of the `struct fp_status' (see <machine/regs.h>) at ADDR.  */
96   PTRACE_SETFPREGS,
97
98   /* Read DATA bytes from the process's data space at address ADDR.
99      Put the result starting at address ADDR2 in the caller's
100      address space.  */
101   PTRACE_READDATA = 16,
102
103   /* Write DATA bytes from ADDR2 in the caller's address space into
104      the process's data space at address ADDR.  */
105   PTRACE_WRITEDATA,
106
107   /* Read DATA bytes from the process's text space at address ADDR.
108      Put the result starting at address ADDR2 in the caller's
109      address space.  */
110   PTRACE_READTEXT = 18,
111
112   /* Write DATA bytes from ADDR2 in the caller's address space into
113      the process's text space at address ADDR.  */
114   PTRACE_WRITETEXT,
115
116   /* Read the floating-point accelerator unit registers and
117      put them into the `struct fpa_regs' (see <machine/regs.h>) at ADDR.  */
118   PTRACE_GETFPAREGS = 20,
119
120   /* Write the floating-point accelerator unit registers from
121      the contents of the `struct fpa_regs' at ADDR.  */
122   PTRACE_SETFPAREGS
123 };
124
125 /* Perform process tracing functions.  REQUEST is one of the values
126    above, and determines the action to be taken.
127    For all requests except PTRACE_TRACEME, PID specifies the process to be
128    traced.
129
130    PID and the other arguments described above for the various requests should
131    appear (those that are used for the particular request) as:
132      pid_t PID, void *ADDR, int DATA, void *ADDR2
133    after REQUEST.  */
134 extern int ptrace (enum __ptrace_request __request, ...);
135
136 __END_DECLS
137
138 #endif /* ptrace.h */