]>
Commit | Line | Data |
---|---|---|
847b055c | 1 | /* `ptrace' debugger support interface. Linux version. |
b168057a | 2 | Copyright (C) 2000-2015 Free Software Foundation, Inc. |
847b055c AJ |
3 | Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). |
4 | This file is part of the GNU C Library. | |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
847b055c AJ |
10 | |
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 14 | Lesser General Public License for more details. |
847b055c | 15 | |
41bdb6e2 | 16 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ | |
847b055c AJ |
19 | |
20 | #ifndef _SYS_PTRACE_H | |
21 | #define _SYS_PTRACE_H 1 | |
22 | ||
23 | #include <features.h> | |
521c6785 | 24 | #include <bits/types.h> |
847b055c AJ |
25 | |
26 | __BEGIN_DECLS | |
27 | #ifdef _LINUX_PTRACE_H | |
28 | /* Kludge to stop stuff gdb & strace compiles from getting upset | |
29 | */ | |
30 | #undef PTRACE_TRACEME | |
31 | #undef PTRACE_PEEKTEXT | |
32 | #undef PTRACE_PEEKDATA | |
33 | #undef PTRACE_PEEKUSR | |
34 | #undef PTRACE_POKETEXT | |
35 | #undef PTRACE_POKEDATA | |
36 | #undef PTRACE_POKEUSR | |
37 | #undef PTRACE_CONT | |
38 | #undef PTRACE_KILL | |
39 | #undef PTRACE_SINGLESTEP | |
40 | ||
41 | #undef PTRACE_ATTACH | |
42 | #undef PTRACE_DETACH | |
43 | ||
44 | #undef PTRACE_SYSCALL | |
45 | #endif | |
46 | /* Type of the REQUEST argument to `ptrace.' */ | |
47 | enum __ptrace_request | |
48 | { | |
49 | /* Indicate that the process making this request should be traced. | |
50 | All signals received by this process can be intercepted by its | |
51 | parent, and its parent can use the other `ptrace' requests. */ | |
52 | PTRACE_TRACEME = 0, | |
53 | #define PT_TRACE_ME PTRACE_TRACEME | |
54 | ||
55 | /* Return the word in the process's text space at address ADDR. */ | |
56 | PTRACE_PEEKTEXT = 1, | |
57 | #define PT_READ_I PTRACE_PEEKTEXT | |
58 | ||
59 | /* Return the word in the process's data space at address ADDR. */ | |
60 | PTRACE_PEEKDATA = 2, | |
61 | #define PT_READ_D PTRACE_PEEKDATA | |
62 | ||
63 | /* Return the word in the process's user area at offset ADDR. */ | |
64 | PTRACE_PEEKUSER = 3, | |
65 | #define PT_READ_U PTRACE_PEEKUSER | |
66 | ||
67 | /* Write the word DATA into the process's text space at address ADDR. */ | |
68 | PTRACE_POKETEXT = 4, | |
69 | #define PT_WRITE_I PTRACE_POKETEXT | |
70 | ||
71 | /* Write the word DATA into the process's data space at address ADDR. */ | |
72 | PTRACE_POKEDATA = 5, | |
73 | #define PT_WRITE_D PTRACE_POKEDATA | |
74 | ||
75 | /* Write the word DATA into the process's user area at offset ADDR. */ | |
76 | PTRACE_POKEUSER = 6, | |
77 | #define PT_WRITE_U PTRACE_POKEUSER | |
78 | ||
79 | /* Continue the process. */ | |
80 | PTRACE_CONT = 7, | |
81 | #define PT_CONTINUE PTRACE_CONT | |
82 | ||
83 | /* Kill the process. */ | |
84 | PTRACE_KILL = 8, | |
85 | #define PT_KILL PTRACE_KILL | |
86 | ||
87 | /* Single step the process. | |
88 | This is not supported on all machines. */ | |
89 | PTRACE_SINGLESTEP = 9, | |
90 | #define PT_STEP PTRACE_SINGLESTEP | |
91 | ||
92 | /* Get all general purpose registers used by a processes. | |
93 | This is not supported on all machines. */ | |
94 | PTRACE_GETREGS = 12, | |
95 | #define PT_GETREGS PTRACE_GETREGS | |
96 | ||
97 | /* Set all general purpose registers used by a processes. | |
98 | This is not supported on all machines. */ | |
99 | PTRACE_SETREGS = 13, | |
100 | #define PT_SETREGS PTRACE_SETREGS | |
101 | ||
102 | /* Get all floating point registers used by a processes. | |
103 | This is not supported on all machines. */ | |
104 | PTRACE_GETFPREGS = 14, | |
105 | #define PT_GETFPREGS PTRACE_GETFPREGS | |
106 | ||
107 | /* Set all floating point registers used by a processes. | |
108 | This is not supported on all machines. */ | |
109 | PTRACE_SETFPREGS = 15, | |
110 | #define PT_SETFPREGS PTRACE_SETFPREGS | |
111 | ||
112 | /* Attach to a process that is already running. */ | |
113 | PTRACE_ATTACH = 16, | |
114 | #define PT_ATTACH PTRACE_ATTACH | |
115 | ||
116 | /* Detach from a process attached to with PTRACE_ATTACH. */ | |
117 | PTRACE_DETACH = 17, | |
118 | #define PT_DETACH PTRACE_DETACH | |
119 | ||
120 | /* Continue and stop at the next (return from) syscall. */ | |
0466106e | 121 | PTRACE_SYSCALL = 24, |
847b055c | 122 | #define PT_SYSCALL PTRACE_SYSCALL |
0466106e UD |
123 | |
124 | /* Set ptrace filter options. */ | |
125 | PTRACE_SETOPTIONS = 0x4200, | |
126 | #define PT_SETOPTIONS PTRACE_SETOPTIONS | |
127 | ||
128 | /* Get last ptrace message. */ | |
129 | PTRACE_GETEVENTMSG = 0x4201, | |
130 | #define PT_GETEVENTMSG PTRACE_GETEVENTMSG | |
131 | ||
132 | /* Get siginfo for process. */ | |
133 | PTRACE_GETSIGINFO = 0x4202, | |
134 | #define PT_GETSIGINFO PTRACE_GETSIGINFO | |
135 | ||
136 | /* Set new siginfo for process. */ | |
6761ac04 | 137 | PTRACE_SETSIGINFO = 0x4203, |
0466106e | 138 | #define PT_SETSIGINFO PTRACE_SETSIGINFO |
cbff0d96 UD |
139 | |
140 | /* Get register content. */ | |
141 | PTRACE_GETREGSET = 0x4204, | |
142 | #define PTRACE_GETREGSET PTRACE_GETREGSET | |
143 | ||
144 | /* Set register content. */ | |
145 | PTRACE_SETREGSET = 0x4205, | |
146 | #define PTRACE_SETREGSET PTRACE_SETREGSET | |
147 | ||
148 | /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect | |
149 | signal or group stop state. */ | |
150 | PTRACE_SEIZE = 0x4206, | |
151 | #define PTRACE_SEIZE PTRACE_SEIZE | |
152 | ||
153 | /* Trap seized tracee. */ | |
154 | PTRACE_INTERRUPT = 0x4207, | |
155 | #define PTRACE_INTERRUPT PTRACE_INTERRUPT | |
156 | ||
157 | /* Wait for next group event. */ | |
521c6785 AJ |
158 | PTRACE_LISTEN = 0x4208, |
159 | #define PTRACE_LISTEN PTRACE_LISTEN | |
160 | ||
161 | PTRACE_PEEKSIGINFO = 0x4209 | |
162 | #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO | |
cbff0d96 UD |
163 | }; |
164 | ||
165 | ||
166 | /* Flag for PTRACE_LISTEN. */ | |
167 | enum __ptrace_flags | |
168 | { | |
169 | PTRACE_SEIZE_DEVEL = 0x80000000 | |
847b055c AJ |
170 | }; |
171 | ||
b26e274d | 172 | /* Options set using PTRACE_SETOPTIONS. */ |
b1b2aaf8 AJ |
173 | enum __ptrace_setoptions |
174 | { | |
b26e274d AJ |
175 | PTRACE_O_TRACESYSGOOD = 0x00000001, |
176 | PTRACE_O_TRACEFORK = 0x00000002, | |
177 | PTRACE_O_TRACEVFORK = 0x00000004, | |
178 | PTRACE_O_TRACECLONE = 0x00000008, | |
179 | PTRACE_O_TRACEEXEC = 0x00000010, | |
180 | PTRACE_O_TRACEVFORKDONE = 0x00000020, | |
181 | PTRACE_O_TRACEEXIT = 0x00000040, | |
b1b2aaf8 | 182 | PTRACE_O_TRACESECCOMP = 0x00000080, |
67525cb8 AJ |
183 | PTRACE_O_EXITKILL = 0x00100000, |
184 | PTRACE_O_MASK = 0x001000ff | |
b26e274d AJ |
185 | }; |
186 | ||
187 | /* Wait extended result codes for the above trace options. */ | |
b1b2aaf8 AJ |
188 | enum __ptrace_eventcodes |
189 | { | |
b26e274d AJ |
190 | PTRACE_EVENT_FORK = 1, |
191 | PTRACE_EVENT_VFORK = 2, | |
192 | PTRACE_EVENT_CLONE = 3, | |
193 | PTRACE_EVENT_EXEC = 4, | |
194 | PTRACE_EVENT_VFORK_DONE = 5, | |
b1b2aaf8 AJ |
195 | PTRACE_EVENT_EXIT = 6, |
196 | PTRACE_EVENT_SECCOMP = 7 | |
b26e274d AJ |
197 | }; |
198 | ||
521c6785 | 199 | /* Arguments for PTRACE_PEEKSIGINFO. */ |
9341dde4 | 200 | struct __ptrace_peeksiginfo_args |
521c6785 AJ |
201 | { |
202 | __uint64_t off; /* From which siginfo to start. */ | |
203 | __uint32_t flags; /* Flags for peeksiginfo. */ | |
204 | __int32_t nr; /* How many siginfos to take. */ | |
205 | }; | |
206 | ||
207 | enum __ptrace_peeksiginfo_flags | |
208 | { | |
209 | /* Read signals from a shared (process wide) queue. */ | |
210 | PTRACE_PEEKSIGINFO_SHARED = (1 << 0) | |
211 | }; | |
212 | ||
847b055c AJ |
213 | /* Perform process tracing functions. REQUEST is one of the values |
214 | above, and determines the action to be taken. | |
215 | For all requests except PTRACE_TRACEME, PID specifies the process to be | |
216 | traced. | |
217 | ||
218 | PID and the other arguments described above for the various requests should | |
219 | appear (those that are used for the particular request) as: | |
220 | pid_t PID, void *ADDR, int DATA, void *ADDR2 | |
221 | after REQUEST. */ | |
b1b2aaf8 | 222 | extern long int ptrace (enum __ptrace_request __request, ...) __THROW; |
847b055c AJ |
223 | |
224 | __END_DECLS | |
225 | ||
226 | #endif /* _SYS_PTRACE_H */ |