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