]>
Commit | Line | Data |
---|---|---|
cd33623e | 1 | /* `ptrace' debugger support interface. Linux/SPARC version. |
568035b7 | 2 | Copyright (C) 1996-2013 Free Software Foundation, Inc. |
cd33623e UD |
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 | |
41bdb6e2 AJ |
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. | |
cd33623e UD |
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 | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
cd33623e | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
cd33623e UD |
18 | |
19 | #ifndef _SYS_PTRACE_H | |
20 | #define _SYS_PTRACE_H 1 | |
21 | ||
22 | #include <features.h> | |
23 | ||
24 | #include <bits/wordsize.h> | |
25 | ||
26 | /* Linux/SPARC kernels up to 2.3.18 do not care much | |
27 | about what namespace polution, so use a kludge now. */ | |
28 | #undef PTRACE_GETREGS | |
29 | #undef PTRACE_SETREGS | |
30 | #undef PTRACE_GETFPREGS | |
31 | #undef PTRACE_SETFPREGS | |
32 | #undef PTRACE_READDATA | |
33 | #undef PTRACE_WRITEDATA | |
34 | #undef PTRACE_READTEXT | |
35 | #undef PTRACE_WRITETEXT | |
36 | #undef PTRACE_SUNDETACH | |
37 | ||
38 | __BEGIN_DECLS | |
39 | ||
40 | /* Type of the REQUEST argument to `ptrace.' */ | |
41 | enum __ptrace_request | |
42 | { | |
43 | /* Indicate that the process making this request should be traced. | |
44 | All signals received by this process can be intercepted by its | |
45 | parent, and its parent can use the other `ptrace' requests. */ | |
46 | PTRACE_TRACEME = 0, | |
47 | #define PT_TRACE_ME PTRACE_TRACEME | |
48 | ||
49 | /* Return the word in the process's text space at address ADDR. */ | |
50 | PTRACE_PEEKTEXT = 1, | |
51 | #define PT_READ_I PTRACE_PEEKTEXT | |
52 | ||
53 | /* Return the word in the process's data space at address ADDR. */ | |
54 | PTRACE_PEEKDATA = 2, | |
55 | #define PT_READ_D PTRACE_PEEKDATA | |
56 | ||
57 | /* Return the word in the process's user area at offset ADDR. */ | |
58 | PTRACE_PEEKUSER = 3, | |
59 | #define PT_READ_U PTRACE_PEEKUSER | |
60 | ||
61 | /* Write the word DATA into the process's text space at address ADDR. */ | |
62 | PTRACE_POKETEXT = 4, | |
63 | #define PT_WRITE_I PTRACE_POKETEXT | |
64 | ||
65 | /* Write the word DATA into the process's data space at address ADDR. */ | |
66 | PTRACE_POKEDATA = 5, | |
67 | #define PT_WRITE_D PTRACE_POKEDATA | |
68 | ||
69 | /* Write the word DATA into the process's user area at offset ADDR. */ | |
70 | PTRACE_POKEUSER = 6, | |
71 | #define PT_WRITE_U PTRACE_POKEUSER | |
72 | ||
73 | /* Continue the process. */ | |
74 | PTRACE_CONT = 7, | |
75 | #define PT_CONTINUE PTRACE_CONT | |
76 | ||
77 | /* Kill the process. */ | |
78 | PTRACE_KILL = 8, | |
79 | #define PT_KILL PTRACE_KILL | |
80 | ||
81 | /* Single step the process. | |
82 | This is not supported on all machines. */ | |
83 | PTRACE_SINGLESTEP = 9, | |
84 | #define PT_STEP PTRACE_SINGLESTEP | |
85 | ||
86 | /* Detach from a process attached to with PTRACE_ATTACH. */ | |
87 | PTRACE_DETACH = 11, | |
88 | #define PT_DETACH PTRACE_DETACH | |
89 | ||
90 | /* This define is needed for older programs which were | |
91 | trying to work around sparc-linux ptrace nastiness. */ | |
92 | #define PTRACE_SUNDETACH PTRACE_DETACH | |
93 | ||
94 | #if __WORDSIZE == 32 | |
95 | ||
96 | /* Get all general purpose registers used by a processes. | |
97 | This is not supported on all machines. */ | |
98 | PTRACE_GETREGS = 12, | |
99 | #define PT_GETREGS PTRACE_GETREGS | |
100 | ||
101 | /* Set all general purpose registers used by a processes. | |
102 | This is not supported on all machines. */ | |
103 | PTRACE_SETREGS = 13, | |
104 | #define PT_SETREGS PTRACE_SETREGS | |
105 | ||
106 | /* Get all floating point registers used by a processes. | |
107 | This is not supported on all machines. */ | |
108 | PTRACE_GETFPREGS = 14, | |
109 | #define PT_GETFPREGS PTRACE_GETFPREGS | |
110 | ||
111 | /* Set all floating point registers used by a processes. | |
112 | This is not supported on all machines. */ | |
113 | PTRACE_SETFPREGS = 15, | |
114 | #define PT_SETFPREGS PTRACE_SETFPREGS | |
115 | ||
116 | #endif | |
117 | ||
118 | /* Attach to a process that is already running. */ | |
119 | PTRACE_ATTACH = 16, | |
120 | #define PT_ATTACH PTRACE_ATTACH | |
121 | ||
54021487 UD |
122 | /* Write several bytes at a time. */ |
123 | PTRACE_WRITEDATA = 17, | |
124 | #define PTRACE_WRITEDATA PTRACE_WRITEDATA | |
125 | ||
cd33623e UD |
126 | /* Read several bytes at a time. */ |
127 | PTRACE_READTEXT = 18, | |
54021487 UD |
128 | #define PTRACE_READTEXT PTRACE_READTEXT |
129 | #define PTRACE_READDATA PTRACE_READTEXT | |
cd33623e UD |
130 | |
131 | /* Write several bytes at a time. */ | |
132 | PTRACE_WRITETEXT = 19, | |
54021487 | 133 | #define PTRACE_WRITETEXT PTRACE_WRITETEXT |
cd33623e UD |
134 | |
135 | #if __WORDSIZE == 64 | |
136 | ||
137 | /* Get all general purpose registers used by a processes. | |
138 | This is not supported on all machines. */ | |
139 | PTRACE_GETREGS = 22, | |
140 | #define PT_GETREGS PTRACE_GETREGS | |
141 | ||
142 | /* Set all general purpose registers used by a processes. | |
143 | This is not supported on all machines. */ | |
144 | PTRACE_SETREGS = 23, | |
145 | #define PT_SETREGS PTRACE_SETREGS | |
146 | ||
147 | #endif | |
148 | ||
149 | /* Continue and stop at the next (return from) syscall. */ | |
0466106e | 150 | PTRACE_SYSCALL = 24, |
cd33623e UD |
151 | #define PTRACE_SYSCALL PTRACE_SYSCALL |
152 | ||
153 | #if __WORDSIZE == 64 | |
154 | ||
155 | /* Get all floating point registers used by a processes. | |
156 | This is not supported on all machines. */ | |
157 | PTRACE_GETFPREGS = 25, | |
158 | #define PT_GETFPREGS PTRACE_GETFPREGS | |
159 | ||
160 | /* Set all floating point registers used by a processes. | |
161 | This is not supported on all machines. */ | |
0466106e | 162 | PTRACE_SETFPREGS = 26, |
cd33623e UD |
163 | #define PT_SETFPREGS PTRACE_SETFPREGS |
164 | ||
165 | #endif | |
0466106e UD |
166 | |
167 | /* Set ptrace filter options. */ | |
168 | PTRACE_SETOPTIONS = 0x4200, | |
169 | #define PT_SETOPTIONS PTRACE_SETOPTIONS | |
170 | ||
171 | /* Get last ptrace message. */ | |
172 | PTRACE_GETEVENTMSG = 0x4201, | |
173 | #define PT_GETEVENTMSG PTRACE_GETEVENTMSG | |
174 | ||
175 | /* Get siginfo for process. */ | |
176 | PTRACE_GETSIGINFO = 0x4202, | |
177 | #define PT_GETSIGINFO PTRACE_GETSIGINFO | |
178 | ||
179 | /* Set new siginfo for process. */ | |
6761ac04 | 180 | PTRACE_SETSIGINFO = 0x4203, |
0466106e | 181 | #define PT_SETSIGINFO PTRACE_SETSIGINFO |
cbff0d96 UD |
182 | |
183 | /* Get register content. */ | |
184 | PTRACE_GETREGSET = 0x4204, | |
185 | #define PTRACE_GETREGSET PTRACE_GETREGSET | |
186 | ||
187 | /* Set register content. */ | |
188 | PTRACE_SETREGSET = 0x4205, | |
189 | #define PTRACE_SETREGSET PTRACE_SETREGSET | |
190 | ||
191 | /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect | |
192 | signal or group stop state. */ | |
193 | PTRACE_SEIZE = 0x4206, | |
194 | #define PTRACE_SEIZE PTRACE_SEIZE | |
195 | ||
196 | /* Trap seized tracee. */ | |
197 | PTRACE_INTERRUPT = 0x4207, | |
198 | #define PTRACE_INTERRUPT PTRACE_INTERRUPT | |
199 | ||
200 | /* Wait for next group event. */ | |
201 | PTRACE_LISTEN = 0x4208 | |
202 | }; | |
203 | ||
204 | ||
205 | /* Flag for PTRACE_LISTEN. */ | |
206 | enum __ptrace_flags | |
207 | { | |
208 | PTRACE_SEIZE_DEVEL = 0x80000000 | |
cd33623e UD |
209 | }; |
210 | ||
b26e274d | 211 | /* Options set using PTRACE_SETOPTIONS. */ |
b1b2aaf8 AJ |
212 | enum __ptrace_setoptions |
213 | { | |
b26e274d AJ |
214 | PTRACE_O_TRACESYSGOOD = 0x00000001, |
215 | PTRACE_O_TRACEFORK = 0x00000002, | |
216 | PTRACE_O_TRACEVFORK = 0x00000004, | |
217 | PTRACE_O_TRACECLONE = 0x00000008, | |
218 | PTRACE_O_TRACEEXEC = 0x00000010, | |
219 | PTRACE_O_TRACEVFORKDONE = 0x00000020, | |
220 | PTRACE_O_TRACEEXIT = 0x00000040, | |
b1b2aaf8 | 221 | PTRACE_O_TRACESECCOMP = 0x00000080, |
67525cb8 AJ |
222 | PTRACE_O_EXITKILL = 0x00100000, |
223 | PTRACE_O_MASK = 0x001000ff | |
b26e274d AJ |
224 | }; |
225 | ||
226 | /* Wait extended result codes for the above trace options. */ | |
b1b2aaf8 AJ |
227 | enum __ptrace_eventcodes |
228 | { | |
b26e274d AJ |
229 | PTRACE_EVENT_FORK = 1, |
230 | PTRACE_EVENT_VFORK = 2, | |
231 | PTRACE_EVENT_CLONE = 3, | |
232 | PTRACE_EVENT_EXEC = 4, | |
233 | PTRACE_EVENT_VFORK_DONE = 5, | |
b1b2aaf8 AJ |
234 | PTRACE_EVENT_EXIT = 6, |
235 | PTRACE_EVENT_SECCOMP = 7 | |
b26e274d AJ |
236 | }; |
237 | ||
cd33623e UD |
238 | /* Perform process tracing functions. REQUEST is one of the values |
239 | above, and determines the action to be taken. | |
240 | For all requests except PTRACE_TRACEME, PID specifies the process to be | |
241 | traced. | |
242 | ||
243 | PID and the other arguments described above for the various requests should | |
244 | appear (those that are used for the particular request) as: | |
245 | pid_t PID, void *ADDR, int DATA, void *ADDR2 | |
246 | after REQUEST. */ | |
ef8ff6ef | 247 | extern long int ptrace (enum __ptrace_request __request, ...) __THROW; |
cd33623e UD |
248 | |
249 | __END_DECLS | |
250 | ||
251 | #endif /* _SYS_PTRACE_H */ |