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