| 1 | /* `ptrace' debugger support interface. Linux/S390 version. |
| 2 | Copyright (C) 2000-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 | #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 | # undef PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG |
| 90 | # undef PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG |
| 91 | #endif |
| 92 | /* Type of the REQUEST argument to `ptrace.' */ |
| 93 | enum __ptrace_request |
| 94 | { |
| 95 | /* Indicate that the process making this request should be traced. |
| 96 | All signals received by this process can be intercepted by its |
| 97 | parent, and its parent can use the other `ptrace' requests. */ |
| 98 | PTRACE_TRACEME = 0, |
| 99 | #define PT_TRACE_ME PTRACE_TRACEME |
| 100 | |
| 101 | /* Return the word in the process's text space at address ADDR. */ |
| 102 | PTRACE_PEEKTEXT = 1, |
| 103 | #define PT_READ_I PTRACE_PEEKTEXT |
| 104 | |
| 105 | /* Return the word in the process's data space at address ADDR. */ |
| 106 | PTRACE_PEEKDATA = 2, |
| 107 | #define PT_READ_D PTRACE_PEEKDATA |
| 108 | |
| 109 | /* Return the word in the process's user area at offset ADDR. */ |
| 110 | PTRACE_PEEKUSER = 3, |
| 111 | #define PT_READ_U PTRACE_PEEKUSER |
| 112 | |
| 113 | /* Write the word DATA into the process's text space at address ADDR. */ |
| 114 | PTRACE_POKETEXT = 4, |
| 115 | #define PT_WRITE_I PTRACE_POKETEXT |
| 116 | |
| 117 | /* Write the word DATA into the process's data space at address ADDR. */ |
| 118 | PTRACE_POKEDATA = 5, |
| 119 | #define PT_WRITE_D PTRACE_POKEDATA |
| 120 | |
| 121 | /* Write the word DATA into the process's user area at offset ADDR. */ |
| 122 | PTRACE_POKEUSER = 6, |
| 123 | #define PT_WRITE_U PTRACE_POKEUSER |
| 124 | |
| 125 | /* Continue the process. */ |
| 126 | PTRACE_CONT = 7, |
| 127 | #define PT_CONTINUE PTRACE_CONT |
| 128 | |
| 129 | /* Kill the process. */ |
| 130 | PTRACE_KILL = 8, |
| 131 | #define PT_KILL PTRACE_KILL |
| 132 | |
| 133 | /* Single step the process. */ |
| 134 | PTRACE_SINGLESTEP = 9, |
| 135 | #define PT_STEP PTRACE_SINGLESTEP |
| 136 | |
| 137 | /* Execute process until next taken branch. */ |
| 138 | PTRACE_SINGLEBLOCK = 12, |
| 139 | #define PT_STEPBLOCK PTRACE_SINGLEBLOCK |
| 140 | |
| 141 | /* Attach to a process that is already running. */ |
| 142 | PTRACE_ATTACH = 16, |
| 143 | #define PT_ATTACH PTRACE_ATTACH |
| 144 | |
| 145 | /* Detach from a process attached to with PTRACE_ATTACH. */ |
| 146 | PTRACE_DETACH = 17, |
| 147 | #define PT_DETACH PTRACE_DETACH |
| 148 | |
| 149 | /* Continue and stop at the next entry to or return from syscall. */ |
| 150 | PTRACE_SYSCALL = 24, |
| 151 | #define PT_SYSCALL PTRACE_SYSCALL |
| 152 | |
| 153 | /* Continue and stop at the next syscall, it will not be executed. */ |
| 154 | PTRACE_SYSEMU = 31, |
| 155 | #define PT_SYSEMU PTRACE_SYSEMU |
| 156 | |
| 157 | /* Single step the process, the next syscall will not be executed. */ |
| 158 | PTRACE_SYSEMU_SINGLESTEP = 32, |
| 159 | #define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP |
| 160 | |
| 161 | /* Set ptrace filter options. */ |
| 162 | PTRACE_SETOPTIONS = 0x4200, |
| 163 | #define PT_SETOPTIONS PTRACE_SETOPTIONS |
| 164 | |
| 165 | /* Get last ptrace message. */ |
| 166 | PTRACE_GETEVENTMSG = 0x4201, |
| 167 | #define PT_GETEVENTMSG PTRACE_GETEVENTMSG |
| 168 | |
| 169 | /* Get siginfo for process. */ |
| 170 | PTRACE_GETSIGINFO = 0x4202, |
| 171 | #define PT_GETSIGINFO PTRACE_GETSIGINFO |
| 172 | |
| 173 | /* Set new siginfo for process. */ |
| 174 | PTRACE_SETSIGINFO = 0x4203, |
| 175 | #define PT_SETSIGINFO PTRACE_SETSIGINFO |
| 176 | |
| 177 | /* Get register content. */ |
| 178 | PTRACE_GETREGSET = 0x4204, |
| 179 | #define PTRACE_GETREGSET PTRACE_GETREGSET |
| 180 | |
| 181 | /* Set register content. */ |
| 182 | PTRACE_SETREGSET = 0x4205, |
| 183 | #define PTRACE_SETREGSET PTRACE_SETREGSET |
| 184 | |
| 185 | /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect |
| 186 | signal or group stop state. */ |
| 187 | PTRACE_SEIZE = 0x4206, |
| 188 | #define PTRACE_SEIZE PTRACE_SEIZE |
| 189 | |
| 190 | /* Trap seized tracee. */ |
| 191 | PTRACE_INTERRUPT = 0x4207, |
| 192 | #define PTRACE_INTERRUPT PTRACE_INTERRUPT |
| 193 | |
| 194 | /* Wait for next group event. */ |
| 195 | PTRACE_LISTEN = 0x4208, |
| 196 | #define PTRACE_LISTEN PTRACE_LISTEN |
| 197 | |
| 198 | /* Retrieve siginfo_t structures without removing signals from a queue. */ |
| 199 | PTRACE_PEEKSIGINFO = 0x4209, |
| 200 | #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO |
| 201 | |
| 202 | /* Get the mask of blocked signals. */ |
| 203 | PTRACE_GETSIGMASK = 0x420a, |
| 204 | #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK |
| 205 | |
| 206 | /* Change the mask of blocked signals. */ |
| 207 | PTRACE_SETSIGMASK = 0x420b, |
| 208 | #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK |
| 209 | |
| 210 | /* Get seccomp BPF filters. */ |
| 211 | PTRACE_SECCOMP_GET_FILTER = 0x420c, |
| 212 | #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER |
| 213 | |
| 214 | /* Get seccomp BPF filter metadata. */ |
| 215 | PTRACE_SECCOMP_GET_METADATA = 0x420d, |
| 216 | #define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA |
| 217 | |
| 218 | /* Get information about system call. */ |
| 219 | PTRACE_GET_SYSCALL_INFO = 0x420e, |
| 220 | #define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO |
| 221 | |
| 222 | /* Get rseq configuration information. */ |
| 223 | PTRACE_GET_RSEQ_CONFIGURATION = 0x420f, |
| 224 | #define PTRACE_GET_RSEQ_CONFIGURATION PTRACE_GET_RSEQ_CONFIGURATION |
| 225 | |
| 226 | /* Set configuration for syscall user dispatch. */ |
| 227 | PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG = 0x4210, |
| 228 | #define PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG \ |
| 229 | PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG |
| 230 | |
| 231 | /* Get configuration for syscall user dispatch. */ |
| 232 | PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG = 0x4211, |
| 233 | #define PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG \ |
| 234 | PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG |
| 235 | |
| 236 | PTRACE_PEEKUSR_AREA = 0x5000, |
| 237 | #define PTRACE_PEEKUSR_AREA PTRACE_PEEKUSR_AREA |
| 238 | |
| 239 | PTRACE_POKEUSR_AREA = 0x5001, |
| 240 | #define PTRACE_POKEUSR_AREA PTRACE_POKEUSR_AREA |
| 241 | |
| 242 | PTRACE_GET_LAST_BREAK = 0x5006, |
| 243 | #define PTRACE_GET_LAST_BREAK PTRACE_GET_LAST_BREAK |
| 244 | |
| 245 | PTRACE_ENABLE_TE = 0x5009, |
| 246 | #define PTRACE_ENABLE_TE PTRACE_ENABLE_TE |
| 247 | |
| 248 | PTRACE_DISABLE_TE = 0x5010, |
| 249 | #define PTRACE_DISABLE_TE PTRACE_DISABLE_TE |
| 250 | |
| 251 | PTRACE_TE_ABORT_RAND = 0x5011 |
| 252 | #define PTRACE_TE_ABORT_RAND PTRACE_TE_ABORT_RAND |
| 253 | }; |
| 254 | |
| 255 | |
| 256 | #include <bits/ptrace-shared.h> |
| 257 | |
| 258 | __END_DECLS |
| 259 | |
| 260 | #endif /* _SYS_PTRACE_H */ |