1 /* `ptrace' debugger support interface.  Linux/S390 version.
2    Copyright (C) 2000-2022 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 #if defined _LINUX_PTRACE_H || defined _S390_PTRACE_H
27 /* Kludge to stop stuff gdb & strace compiles from getting upset
28  */
29 # undef PTRACE_TRACEME
30 # undef PTRACE_PEEKTEXT
31 # undef PTRACE_PEEKDATA
32 # undef PTRACE_POKETEXT
33 # undef PTRACE_POKEDATA
34 # undef PTRACE_CONT
35 # undef PTRACE_KILL
36 # undef PTRACE_SINGLESTEP
37 # undef PTRACE_SINGLEBLOCK
38 # undef PTRACE_ATTACH
39 # undef PTRACE_DETACH
40 # undef PTRACE_SYSCALL
41 # undef PTRACE_SYSEMU
42 # undef PTRACE_SYSEMU_SINGLESTEP
43 # undef PTRACE_SETOPTIONS
44 # undef PTRACE_GETEVENTMSG
45 # undef PTRACE_GETSIGINFO
46 # undef PTRACE_SETSIGINFO
47 # undef PTRACE_GETREGSET
48 # undef PTRACE_SETREGSET
49 # undef PTRACE_SEIZE
50 # undef PTRACE_INTERRUPT
51 # undef PTRACE_LISTEN
52 # undef PTRACE_PEEKSIGINFO
53 # undef PTRACE_GETSIGMASK
54 # undef PTRACE_SETSIGMASK
55 # undef PTRACE_SECCOMP_GET_FILTER
56 # undef PTRACE_SECCOMP_GET_METADATA
57 # undef PTRACE_PEEKUSR_AREA
58 # undef PTRACE_POKEUSR_AREA
59 # undef PTRACE_GET_LAST_BREAK
60 # undef PTRACE_ENABLE_TE
61 # undef PTRACE_DISABLE_TE
62 # undef PTRACE_TE_ABORT_RAND
63 # undef PTRACE_O_TRACESYSGOOD
64 # undef PTRACE_O_TRACEFORK
65 # undef PTRACE_O_TRACEVFORK
66 # undef PTRACE_O_TRACECLONE
67 # undef PTRACE_O_TRACEEXEC
68 # undef PTRACE_O_TRACEVFORKDONE
69 # undef PTRACE_O_TRACEEXIT
70 # undef PTRACE_O_TRACESECCOMP
71 # undef PTRACE_O_EXITKILL
72 # undef PTRACE_O_SUSPEND_SECCOMP
73 # undef PTRACE_O_MASK
74 # undef PTRACE_EVENT_FORK
75 # undef PTRACE_EVENT_VFORK
76 # undef PTRACE_EVENT_CLONE
77 # undef PTRACE_EVENT_EXEC
78 # undef PTRACE_EVENT_VFORK_DONE
79 # undef PTRACE_EVENT_EXIT
80 # undef PTRACE_EVENT_SECCOMP
81 # undef PTRACE_EVENT_STOP
82 # undef PTRACE_PEEKSIGINFO_SHARED
83 # undef PTRACE_GET_SYSCALL_INFO
84 # undef PTRACE_SYSCALL_INFO_NONE
85 # undef PTRACE_SYSCALL_INFO_ENTRY
86 # undef PTRACE_SYSCALL_INFO_EXIT
87 # undef PTRACE_SYSCALL_INFO_SECCOMP
88 # undef PTRACE_GET_RSEQ_CONFIGURATION
89 #endif
90 /* Type of the REQUEST argument to `ptrace.'  */
91 enum __ptrace_request
92 {
93   /* Indicate that the process making this request should be traced.
94      All signals received by this process can be intercepted by its
95      parent, and its parent can use the other `ptrace' requests.  */
96   PTRACE_TRACEME = 0,
97 #define PT_TRACE_ME PTRACE_TRACEME
98 
99   /* Return the word in the process's text space at address ADDR.  */
100   PTRACE_PEEKTEXT = 1,
101 #define PT_READ_I PTRACE_PEEKTEXT
102 
103   /* Return the word in the process's data space at address ADDR.  */
104   PTRACE_PEEKDATA = 2,
105 #define PT_READ_D PTRACE_PEEKDATA
106 
107   /* Return the word in the process's user area at offset ADDR.  */
108   PTRACE_PEEKUSER = 3,
109 #define PT_READ_U PTRACE_PEEKUSER
110 
111   /* Write the word DATA into the process's text space at address ADDR.  */
112   PTRACE_POKETEXT = 4,
113 #define PT_WRITE_I PTRACE_POKETEXT
114 
115   /* Write the word DATA into the process's data space at address ADDR.  */
116   PTRACE_POKEDATA = 5,
117 #define PT_WRITE_D PTRACE_POKEDATA
118 
119   /* Write the word DATA into the process's user area at offset ADDR.  */
120   PTRACE_POKEUSER = 6,
121 #define PT_WRITE_U PTRACE_POKEUSER
122 
123   /* Continue the process.  */
124   PTRACE_CONT = 7,
125 #define PT_CONTINUE PTRACE_CONT
126 
127   /* Kill the process.  */
128   PTRACE_KILL = 8,
129 #define PT_KILL PTRACE_KILL
130 
131   /* Single step the process.  */
132   PTRACE_SINGLESTEP = 9,
133 #define PT_STEP PTRACE_SINGLESTEP
134 
135   /* Execute process until next taken branch.  */
136   PTRACE_SINGLEBLOCK = 12,
137 #define PT_STEPBLOCK PTRACE_SINGLEBLOCK
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   /* Continue and stop at the next entry to or return from syscall.  */
148   PTRACE_SYSCALL = 24,
149 #define PT_SYSCALL PTRACE_SYSCALL
150 
151   /* Continue and stop at the next syscall, it will not be executed.  */
152   PTRACE_SYSEMU = 31,
153 #define PT_SYSEMU PTRACE_SYSEMU
154 
155   /* Single step the process, the next syscall will not be executed.  */
156   PTRACE_SYSEMU_SINGLESTEP = 32,
157 #define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
158 
159   /* Set ptrace filter options.  */
160   PTRACE_SETOPTIONS = 0x4200,
161 #define PT_SETOPTIONS PTRACE_SETOPTIONS
162 
163   /* Get last ptrace message.  */
164   PTRACE_GETEVENTMSG = 0x4201,
165 #define PT_GETEVENTMSG PTRACE_GETEVENTMSG
166 
167   /* Get siginfo for process.  */
168   PTRACE_GETSIGINFO = 0x4202,
169 #define PT_GETSIGINFO PTRACE_GETSIGINFO
170 
171   /* Set new siginfo for process.  */
172   PTRACE_SETSIGINFO = 0x4203,
173 #define PT_SETSIGINFO PTRACE_SETSIGINFO
174 
175   /* Get register content.  */
176   PTRACE_GETREGSET = 0x4204,
177 #define PTRACE_GETREGSET PTRACE_GETREGSET
178 
179   /* Set register content.  */
180   PTRACE_SETREGSET = 0x4205,
181 #define PTRACE_SETREGSET PTRACE_SETREGSET
182 
183   /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
184      signal or group stop state.  */
185   PTRACE_SEIZE = 0x4206,
186 #define PTRACE_SEIZE PTRACE_SEIZE
187 
188   /* Trap seized tracee.  */
189   PTRACE_INTERRUPT = 0x4207,
190 #define PTRACE_INTERRUPT PTRACE_INTERRUPT
191 
192   /* Wait for next group event.  */
193   PTRACE_LISTEN = 0x4208,
194 #define PTRACE_LISTEN PTRACE_LISTEN
195 
196   /* Retrieve siginfo_t structures without removing signals from a queue.  */
197   PTRACE_PEEKSIGINFO = 0x4209,
198 #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
199 
200   /* Get the mask of blocked signals.  */
201   PTRACE_GETSIGMASK = 0x420a,
202 #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
203 
204   /* Change the mask of blocked signals.  */
205   PTRACE_SETSIGMASK = 0x420b,
206 #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
207 
208   /* Get seccomp BPF filters.  */
209   PTRACE_SECCOMP_GET_FILTER = 0x420c,
210 #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
211 
212   /* Get seccomp BPF filter metadata.  */
213   PTRACE_SECCOMP_GET_METADATA = 0x420d,
214 #define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
215 
216   /* Get information about system call.  */
217   PTRACE_GET_SYSCALL_INFO = 0x420e,
218 #define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
219 
220   /* Get rseq configuration information.  */
221   PTRACE_GET_RSEQ_CONFIGURATION = 0x420f,
222 #define PTRACE_GET_RSEQ_CONFIGURATION PTRACE_GET_RSEQ_CONFIGURATION
223 
224   PTRACE_PEEKUSR_AREA = 0x5000,
225 #define PTRACE_PEEKUSR_AREA PTRACE_PEEKUSR_AREA
226 
227   PTRACE_POKEUSR_AREA = 0x5001,
228 #define PTRACE_POKEUSR_AREA PTRACE_POKEUSR_AREA
229 
230   PTRACE_GET_LAST_BREAK = 0x5006,
231 #define PTRACE_GET_LAST_BREAK PTRACE_GET_LAST_BREAK
232 
233   PTRACE_ENABLE_TE = 0x5009,
234 #define PTRACE_ENABLE_TE PTRACE_ENABLE_TE
235 
236   PTRACE_DISABLE_TE = 0x5010,
237 #define PTRACE_DISABLE_TE PTRACE_DISABLE_TE
238 
239   PTRACE_TE_ABORT_RAND = 0x5011
240 #define PTRACE_TE_ABORT_RAND PTRACE_TE_ABORT_RAND
241 };
242 
243 
244 #include <bits/ptrace-shared.h>
245 
246 __END_DECLS
247 
248 #endif /* _SYS_PTRACE_H */
249