]>
Commit | Line | Data |
---|---|---|
951d5dd8 | 1 | /* `ptrace' debugger support interface. Linux version. |
bfff8b1b | 2 | Copyright (C) 2001-2017 Free Software Foundation, Inc. |
951d5dd8 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. | |
951d5dd8 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. |
951d5dd8 | 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/>. */ | |
951d5dd8 UD |
18 | |
19 | #ifndef _SYS_PTRACE_H | |
20 | #define _SYS_PTRACE_H 1 | |
21 | ||
22 | #include <features.h> | |
521c6785 | 23 | #include <bits/types.h> |
951d5dd8 UD |
24 | |
25 | __BEGIN_DECLS | |
26 | ||
27 | /* Type of the REQUEST argument to `ptrace.' */ | |
28 | enum __ptrace_request | |
29 | { | |
30 | /* Indicate that the process making this request should be traced. | |
31 | All signals received by this process can be intercepted by its | |
32 | parent, and its parent can use the other `ptrace' requests. */ | |
33 | PTRACE_TRACEME = 0, | |
34 | #define PT_TRACE_ME PTRACE_TRACEME | |
35 | ||
36 | /* Return the word in the process's text space at address ADDR. */ | |
37 | PTRACE_PEEKTEXT = 1, | |
38 | #define PT_READ_I PTRACE_PEEKTEXT | |
39 | ||
40 | /* Return the word in the process's data space at address ADDR. */ | |
41 | PTRACE_PEEKDATA = 2, | |
42 | #define PT_READ_D PTRACE_PEEKDATA | |
43 | ||
44 | /* Return the word in the process's user area at offset ADDR. */ | |
45 | PTRACE_PEEKUSER = 3, | |
46 | #define PT_READ_U PTRACE_PEEKUSER | |
47 | ||
48 | /* Write the word DATA into the process's text space at address ADDR. */ | |
49 | PTRACE_POKETEXT = 4, | |
50 | #define PT_WRITE_I PTRACE_POKETEXT | |
51 | ||
52 | /* Write the word DATA into the process's data space at address ADDR. */ | |
53 | PTRACE_POKEDATA = 5, | |
54 | #define PT_WRITE_D PTRACE_POKEDATA | |
55 | ||
56 | /* Write the word DATA into the process's user area at offset ADDR. */ | |
57 | PTRACE_POKEUSER = 6, | |
58 | #define PT_WRITE_U PTRACE_POKEUSER | |
59 | ||
60 | /* Continue the process. */ | |
61 | PTRACE_CONT = 7, | |
62 | #define PT_CONTINUE PTRACE_CONT | |
63 | ||
64 | /* Kill the process. */ | |
65 | PTRACE_KILL = 8, | |
66 | #define PT_KILL PTRACE_KILL | |
67 | ||
68 | /* Single step the process. | |
69 | This is not supported on all machines. */ | |
70 | PTRACE_SINGLESTEP = 9, | |
71 | #define PT_STEP PTRACE_SINGLESTEP | |
72 | ||
73 | /* Attach to a process that is already running. */ | |
74 | PTRACE_ATTACH = 16, | |
75 | #define PT_ATTACH PTRACE_ATTACH | |
76 | ||
77 | /* Detach from a process attached to with PTRACE_ATTACH. */ | |
78 | PTRACE_DETACH = 17, | |
79 | #define PT_DETACH PTRACE_DETACH | |
80 | ||
81 | /* Continue and stop at the next (return from) syscall. */ | |
0466106e | 82 | PTRACE_SYSCALL = 24, |
951d5dd8 | 83 | #define PT_SYSCALL PTRACE_SYSCALL |
0466106e UD |
84 | |
85 | /* Set ptrace filter options. */ | |
86 | PTRACE_SETOPTIONS = 0x4200, | |
87 | #define PT_SETOPTIONS PTRACE_SETOPTIONS | |
88 | ||
89 | /* Get last ptrace message. */ | |
90 | PTRACE_GETEVENTMSG = 0x4201, | |
91 | #define PT_GETEVENTMSG PTRACE_GETEVENTMSG | |
92 | ||
93 | /* Get siginfo for process. */ | |
94 | PTRACE_GETSIGINFO = 0x4202, | |
95 | #define PT_GETSIGINFO PTRACE_GETSIGINFO | |
96 | ||
97 | /* Set new siginfo for process. */ | |
6761ac04 | 98 | PTRACE_SETSIGINFO = 0x4203, |
0466106e | 99 | #define PT_SETSIGINFO PTRACE_SETSIGINFO |
cbff0d96 UD |
100 | |
101 | /* Get register content. */ | |
102 | PTRACE_GETREGSET = 0x4204, | |
103 | #define PTRACE_GETREGSET PTRACE_GETREGSET | |
104 | ||
105 | /* Set register content. */ | |
106 | PTRACE_SETREGSET = 0x4205, | |
107 | #define PTRACE_SETREGSET PTRACE_SETREGSET | |
108 | ||
109 | /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect | |
110 | signal or group stop state. */ | |
111 | PTRACE_SEIZE = 0x4206, | |
112 | #define PTRACE_SEIZE PTRACE_SEIZE | |
113 | ||
114 | /* Trap seized tracee. */ | |
115 | PTRACE_INTERRUPT = 0x4207, | |
116 | #define PTRACE_INTERRUPT PTRACE_INTERRUPT | |
117 | ||
118 | /* Wait for next group event. */ | |
521c6785 AJ |
119 | PTRACE_LISTEN = 0x4208, |
120 | #define PTRACE_LISTEN PTRACE_LISTEN | |
121 | ||
fb53a27c | 122 | PTRACE_PEEKSIGINFO = 0x4209, |
521c6785 | 123 | #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO |
fb53a27c JM |
124 | |
125 | PTRACE_GETSIGMASK = 0x420a, | |
126 | #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK | |
127 | ||
128 | PTRACE_SETSIGMASK = 0x420b, | |
129 | #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK | |
130 | ||
131 | PTRACE_SECCOMP_GET_FILTER = 0x420c | |
132 | #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER | |
cbff0d96 UD |
133 | }; |
134 | ||
135 | ||
136 | /* Flag for PTRACE_LISTEN. */ | |
137 | enum __ptrace_flags | |
138 | { | |
139 | PTRACE_SEIZE_DEVEL = 0x80000000 | |
951d5dd8 UD |
140 | }; |
141 | ||
b26e274d | 142 | /* Options set using PTRACE_SETOPTIONS. */ |
b1b2aaf8 AJ |
143 | enum __ptrace_setoptions |
144 | { | |
b26e274d AJ |
145 | PTRACE_O_TRACESYSGOOD = 0x00000001, |
146 | PTRACE_O_TRACEFORK = 0x00000002, | |
147 | PTRACE_O_TRACEVFORK = 0x00000004, | |
148 | PTRACE_O_TRACECLONE = 0x00000008, | |
149 | PTRACE_O_TRACEEXEC = 0x00000010, | |
150 | PTRACE_O_TRACEVFORKDONE = 0x00000020, | |
151 | PTRACE_O_TRACEEXIT = 0x00000040, | |
b1b2aaf8 | 152 | PTRACE_O_TRACESECCOMP = 0x00000080, |
67525cb8 | 153 | PTRACE_O_EXITKILL = 0x00100000, |
a61a1a25 JM |
154 | PTRACE_O_SUSPEND_SECCOMP = 0x00200000, |
155 | PTRACE_O_MASK = 0x003000ff | |
b26e274d AJ |
156 | }; |
157 | ||
158 | /* Wait extended result codes for the above trace options. */ | |
b1b2aaf8 AJ |
159 | enum __ptrace_eventcodes |
160 | { | |
b26e274d AJ |
161 | PTRACE_EVENT_FORK = 1, |
162 | PTRACE_EVENT_VFORK = 2, | |
163 | PTRACE_EVENT_CLONE = 3, | |
164 | PTRACE_EVENT_EXEC = 4, | |
165 | PTRACE_EVENT_VFORK_DONE = 5, | |
b1b2aaf8 AJ |
166 | PTRACE_EVENT_EXIT = 6, |
167 | PTRACE_EVENT_SECCOMP = 7 | |
b26e274d AJ |
168 | }; |
169 | ||
521c6785 | 170 | /* Arguments for PTRACE_PEEKSIGINFO. */ |
9341dde4 | 171 | struct __ptrace_peeksiginfo_args |
521c6785 AJ |
172 | { |
173 | __uint64_t off; /* From which siginfo to start. */ | |
174 | __uint32_t flags; /* Flags for peeksiginfo. */ | |
175 | __int32_t nr; /* How many siginfos to take. */ | |
176 | }; | |
177 | ||
178 | enum __ptrace_peeksiginfo_flags | |
179 | { | |
180 | /* Read signals from a shared (process wide) queue. */ | |
181 | PTRACE_PEEKSIGINFO_SHARED = (1 << 0) | |
182 | }; | |
183 | ||
951d5dd8 UD |
184 | /* Perform process tracing functions. REQUEST is one of the values |
185 | above, and determines the action to be taken. | |
186 | For all requests except PTRACE_TRACEME, PID specifies the process to be | |
187 | traced. | |
188 | ||
189 | PID and the other arguments described above for the various requests should | |
190 | appear (those that are used for the particular request) as: | |
191 | pid_t PID, void *ADDR, int DATA, void *ADDR2 | |
192 | after REQUEST. */ | |
193 | extern long int ptrace (enum __ptrace_request __request, ...) __THROW; | |
194 | ||
195 | __END_DECLS | |
196 | ||
197 | #endif /* _SYS_PTRACE_H */ |