1 /* `ptrace' debugger support interface.  Linux/PowerPC version.
2    Copyright (C) 2001-2021 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, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 #ifndef _SYS_PTRACE_H
20 #define _SYS_PTRACE_H	1
21 
22 #include <features.h>
23 #include <bits/types.h>
24 
25 __BEGIN_DECLS
26 
27 #if defined _LINUX_PTRACE_H || defined _ASM_POWERPC_PTRACE_H
28 /* Do not let Linux headers macros interfere with enum __ptrace_request.  */
29 # undef PTRACE_ATTACH
30 # undef PTRACE_CONT
31 # undef PTRACE_DETACH
32 # undef PTRACE_GET_DEBUGREG
33 # undef PTRACE_GETEVENTMSG
34 # undef PTRACE_GETEVRREGS
35 # undef PTRACE_GETFPREGS
36 # undef PTRACE_GETREGS
37 # undef PTRACE_GETREGS64
38 # undef PTRACE_GETREGSET
39 # undef PTRACE_GETSIGINFO
40 # undef PTRACE_GETSIGMASK
41 # undef PTRACE_GET_SYSCALL_INFO
42 # undef PTRACE_GETVRREGS
43 # undef PTRACE_GETVSRREGS
44 # undef PTRACE_INTERRUPT
45 # undef PTRACE_KILL
46 # undef PTRACE_LISTEN
47 # undef PTRACE_PEEKDATA
48 # undef PTRACE_PEEKSIGINFO
49 # undef PTRACE_PEEKTEXT
50 # undef PTRACE_POKEDATA
51 # undef PTRACE_POKETEXT
52 # undef PTRACE_SECCOMP_GET_FILTER
53 # undef PTRACE_SECCOMP_GET_METADATA
54 # undef PTRACE_SEIZE
55 # undef PTRACE_SET_DEBUGREG
56 # undef PTRACE_SETEVRREGS
57 # undef PTRACE_SETFPREGS
58 # undef PTRACE_SETOPTIONS
59 # undef PTRACE_SETREGS
60 # undef PTRACE_SETREGS64
61 # undef PTRACE_SETREGSET
62 # undef PTRACE_SETSIGINFO
63 # undef PTRACE_SETSIGMASK
64 # undef PTRACE_SETVRREGS
65 # undef PTRACE_SETVSRREGS
66 # undef PTRACE_SINGLEBLOCK
67 # undef PTRACE_SINGLESTEP
68 # undef PTRACE_SYSCALL
69 # undef PTRACE_SYSCALL_INFO_NONE
70 # undef PTRACE_SYSCALL_INFO_ENTRY
71 # undef PTRACE_SYSCALL_INFO_EXIT
72 # undef PTRACE_SYSCALL_INFO_SECCOMP
73 # undef PTRACE_SYSEMU
74 # undef PTRACE_SYSEMU_SINGLESTEP
75 # undef PTRACE_TRACEME
76 #endif
77 
78 /* Type of the REQUEST argument to `ptrace.'  */
79 enum __ptrace_request
80 {
81   /* Indicate that the process making this request should be traced.
82      All signals received by this process can be intercepted by its
83      parent, and its parent can use the other `ptrace' requests.  */
84   PTRACE_TRACEME = 0,
85 #define PT_TRACE_ME PTRACE_TRACEME
86 
87   /* Return the word in the process's text space at address ADDR.  */
88   PTRACE_PEEKTEXT = 1,
89 #define PT_READ_I PTRACE_PEEKTEXT
90 
91   /* Return the word in the process's data space at address ADDR.  */
92   PTRACE_PEEKDATA = 2,
93 #define PT_READ_D PTRACE_PEEKDATA
94 
95   /* Return the word in the process's user area at offset ADDR.  */
96   PTRACE_PEEKUSER = 3,
97 #define PT_READ_U PTRACE_PEEKUSER
98 
99   /* Write the word DATA into the process's text space at address ADDR.  */
100   PTRACE_POKETEXT = 4,
101 #define PT_WRITE_I PTRACE_POKETEXT
102 
103   /* Write the word DATA into the process's data space at address ADDR.  */
104   PTRACE_POKEDATA = 5,
105 #define PT_WRITE_D PTRACE_POKEDATA
106 
107   /* Write the word DATA into the process's user area at offset ADDR.  */
108   PTRACE_POKEUSER = 6,
109 #define PT_WRITE_U PTRACE_POKEUSER
110 
111   /* Continue the process.  */
112   PTRACE_CONT = 7,
113 #define PT_CONTINUE PTRACE_CONT
114 
115   /* Kill the process.  */
116   PTRACE_KILL = 8,
117 #define PT_KILL PTRACE_KILL
118 
119   /* Single step the process.  */
120   PTRACE_SINGLESTEP = 9,
121 #define PT_STEP PTRACE_SINGLESTEP
122 
123   /* Get all general purpose registers used by a process.  */
124   PTRACE_GETREGS = 12,
125 #define PT_GETREGS PTRACE_GETREGS
126 
127   /* Set all general purpose registers used by a process.  */
128   PTRACE_SETREGS = 13,
129 #define PT_SETREGS PTRACE_SETREGS
130 
131   /* Get all floating point registers used by a process.  */
132   PTRACE_GETFPREGS = 14,
133 #define PT_GETFPREGS PTRACE_GETFPREGS
134 
135   /* Set all floating point registers used by a process.  */
136   PTRACE_SETFPREGS = 15,
137 #define PT_SETFPREGS PTRACE_SETFPREGS
138 
139   /* Attach to a process that is already running. */
140   PTRACE_ATTACH = 16,
141 #define PT_ATTACH PTRACE_ATTACH
142 
143   /* Detach from a process attached to with PTRACE_ATTACH.  */
144   PTRACE_DETACH = 17,
145 #define PT_DETACH PTRACE_DETACH
146 
147   /* Get all altivec registers used by a process.  */
148   PTRACE_GETVRREGS = 18,
149 #define PT_GETVRREGS PTRACE_GETVRREGS
150 
151   /* Set all altivec registers used by a process.  */
152   PTRACE_SETVRREGS = 19,
153 #define PT_SETVRREGS PTRACE_SETVRREGS
154 
155   /* Get all SPE registers used by a process.  */
156   PTRACE_GETEVRREGS = 20,
157 #define PT_GETEVRREGS PTRACE_GETEVRREGS
158 
159   /* Set all SPE registers used by a process.  */
160   PTRACE_SETEVRREGS = 21,
161 #define PT_SETEVRREGS PTRACE_SETEVRREGS
162 
163   /* Same as PTRACE_GETREGS except a 32-bit process will obtain
164      the full 64-bit registers.  Implemented by 64-bit kernels only.  */
165   PTRACE_GETREGS64 = 22,
166 #define PT_GETREGS64 PTRACE_GETREGS64
167 
168   /* Same as PTRACE_SETREGS except a 32-bit process will set
169      the full 64-bit registers.  Implemented by 64-bit kernels only.  */
170   PTRACE_SETREGS64 = 23,
171 #define PT_SETREGS64 PTRACE_SETREGS64
172 
173   /* Continue and stop at the next entry to or return from syscall.  */
174   PTRACE_SYSCALL = 24,
175 #define PT_SYSCALL PTRACE_SYSCALL
176 
177   /* Get a debug register of a process.  */
178   PTRACE_GET_DEBUGREG = 25,
179 #define PT_GET_DEBUGREG PTRACE_GET_DEBUGREG
180 
181   /* Set a debug register of a process.  */
182   PTRACE_SET_DEBUGREG = 26,
183 #define PT_SET_DEBUGREG PTRACE_SET_DEBUGREG
184 
185   /* Get the first 32 VSX registers of a process.  */
186   PTRACE_GETVSRREGS = 27,
187 #define PT_GETVSRREGS PTRACE_GETVSRREGS
188 
189   /* Set the first 32 VSX registers of a process.  */
190   PTRACE_SETVSRREGS = 28,
191 #define PT_SETVSRREGS PTRACE_SETVSRREGS
192 
193   /* Continue and stop at the next syscall, it will not be executed.  */
194   PTRACE_SYSEMU = 29,
195 #define PT_SYSEMU PTRACE_SYSEMU
196 
197   /* Single step the process, the next syscall will not be executed.  */
198   PTRACE_SYSEMU_SINGLESTEP = 30,
199 #define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
200 
201   /* Execute process until next taken branch.  */
202   PTRACE_SINGLEBLOCK = 256,
203 #define PT_STEPBLOCK PTRACE_SINGLEBLOCK
204 
205   /* Set ptrace filter options.  */
206   PTRACE_SETOPTIONS = 0x4200,
207 #define PT_SETOPTIONS PTRACE_SETOPTIONS
208 
209   /* Get last ptrace message.  */
210   PTRACE_GETEVENTMSG = 0x4201,
211 #define PT_GETEVENTMSG PTRACE_GETEVENTMSG
212 
213   /* Get siginfo for process.  */
214   PTRACE_GETSIGINFO = 0x4202,
215 #define PT_GETSIGINFO PTRACE_GETSIGINFO
216 
217   /* Set new siginfo for process.  */
218   PTRACE_SETSIGINFO = 0x4203,
219 #define PT_SETSIGINFO PTRACE_SETSIGINFO
220 
221   /* Get register content.  */
222   PTRACE_GETREGSET = 0x4204,
223 #define PTRACE_GETREGSET PTRACE_GETREGSET
224 
225   /* Set register content.  */
226   PTRACE_SETREGSET = 0x4205,
227 #define PTRACE_SETREGSET PTRACE_SETREGSET
228 
229   /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
230      signal or group stop state.  */
231   PTRACE_SEIZE = 0x4206,
232 #define PTRACE_SEIZE PTRACE_SEIZE
233 
234   /* Trap seized tracee.  */
235   PTRACE_INTERRUPT = 0x4207,
236 #define PTRACE_INTERRUPT PTRACE_INTERRUPT
237 
238   /* Wait for next group event.  */
239   PTRACE_LISTEN = 0x4208,
240 #define PTRACE_LISTEN PTRACE_LISTEN
241 
242   /* Retrieve siginfo_t structures without removing signals from a queue.  */
243   PTRACE_PEEKSIGINFO = 0x4209,
244 #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
245 
246   /* Get the mask of blocked signals.  */
247   PTRACE_GETSIGMASK = 0x420a,
248 #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
249 
250   /* Change the mask of blocked signals.  */
251   PTRACE_SETSIGMASK = 0x420b,
252 #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
253 
254   /* Get seccomp BPF filters.  */
255   PTRACE_SECCOMP_GET_FILTER = 0x420c,
256 #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
257 
258   /* Get seccomp BPF filter metadata.  */
259   PTRACE_SECCOMP_GET_METADATA = 0x420d,
260 #define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
261 
262   /* Get information about system call.  */
263   PTRACE_GET_SYSCALL_INFO = 0x420e
264 #define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
265 };
266 
267 
268 #include <bits/ptrace-shared.h>
269 
270 __END_DECLS
271 
272 #endif /* _SYS_PTRACE_H */