| 1 | /* `ptrace' debugger support interface. Linux/x86 version. |
| 2 | Copyright (C) 1996-2022 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of the GNU C Library. |
| 5 | |
| 6 | The GNU C Library is free software; you can redistribute it and/or |
| 7 | modify it under the terms of the GNU Lesser General Public |
| 8 | License as published by the Free Software Foundation; either |
| 9 | version 2.1 of the License, or (at your option) any later version. |
| 10 | |
| 11 | The GNU C Library is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | Lesser General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU Lesser General Public |
| 17 | License along with the GNU C Library; if not, see |
| 18 | <https://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | #ifndef _SYS_PTRACE_H |
| 21 | #define _SYS_PTRACE_H 1 |
| 22 | |
| 23 | #include <features.h> |
| 24 | #include <bits/types.h> |
| 25 | |
| 26 | __BEGIN_DECLS |
| 27 | |
| 28 | /* Type of the REQUEST argument to `ptrace.' */ |
| 29 | enum __ptrace_request |
| 30 | { |
| 31 | /* Indicate that the process making this request should be traced. |
| 32 | All signals received by this process can be intercepted by its |
| 33 | parent, and its parent can use the other `ptrace' requests. */ |
| 34 | PTRACE_TRACEME = 0, |
| 35 | #define PT_TRACE_ME PTRACE_TRACEME |
| 36 | |
| 37 | /* Return the word in the process's text space at address ADDR. */ |
| 38 | PTRACE_PEEKTEXT = 1, |
| 39 | #define PT_READ_I PTRACE_PEEKTEXT |
| 40 | |
| 41 | /* Return the word in the process's data space at address ADDR. */ |
| 42 | PTRACE_PEEKDATA = 2, |
| 43 | #define PT_READ_D PTRACE_PEEKDATA |
| 44 | |
| 45 | /* Return the word in the process's user area at offset ADDR. */ |
| 46 | PTRACE_PEEKUSER = 3, |
| 47 | #define PT_READ_U PTRACE_PEEKUSER |
| 48 | |
| 49 | /* Write the word DATA into the process's text space at address ADDR. */ |
| 50 | PTRACE_POKETEXT = 4, |
| 51 | #define PT_WRITE_I PTRACE_POKETEXT |
| 52 | |
| 53 | /* Write the word DATA into the process's data space at address ADDR. */ |
| 54 | PTRACE_POKEDATA = 5, |
| 55 | #define PT_WRITE_D PTRACE_POKEDATA |
| 56 | |
| 57 | /* Write the word DATA into the process's user area at offset ADDR. */ |
| 58 | PTRACE_POKEUSER = 6, |
| 59 | #define PT_WRITE_U PTRACE_POKEUSER |
| 60 | |
| 61 | /* Continue the process. */ |
| 62 | PTRACE_CONT = 7, |
| 63 | #define PT_CONTINUE PTRACE_CONT |
| 64 | |
| 65 | /* Kill the process. */ |
| 66 | PTRACE_KILL = 8, |
| 67 | #define PT_KILL PTRACE_KILL |
| 68 | |
| 69 | /* Single step the process. */ |
| 70 | PTRACE_SINGLESTEP = 9, |
| 71 | #define PT_STEP PTRACE_SINGLESTEP |
| 72 | |
| 73 | /* Get all general purpose registers used by a processes. */ |
| 74 | PTRACE_GETREGS = 12, |
| 75 | #define PT_GETREGS PTRACE_GETREGS |
| 76 | |
| 77 | /* Set all general purpose registers used by a processes. */ |
| 78 | PTRACE_SETREGS = 13, |
| 79 | #define PT_SETREGS PTRACE_SETREGS |
| 80 | |
| 81 | /* Get all floating point registers used by a processes. */ |
| 82 | PTRACE_GETFPREGS = 14, |
| 83 | #define PT_GETFPREGS PTRACE_GETFPREGS |
| 84 | |
| 85 | /* Set all floating point registers used by a processes. */ |
| 86 | PTRACE_SETFPREGS = 15, |
| 87 | #define PT_SETFPREGS PTRACE_SETFPREGS |
| 88 | |
| 89 | /* Attach to a process that is already running. */ |
| 90 | PTRACE_ATTACH = 16, |
| 91 | #define PT_ATTACH PTRACE_ATTACH |
| 92 | |
| 93 | /* Detach from a process attached to with PTRACE_ATTACH. */ |
| 94 | PTRACE_DETACH = 17, |
| 95 | #define PT_DETACH PTRACE_DETACH |
| 96 | |
| 97 | /* Get all extended floating point registers used by a processes. */ |
| 98 | PTRACE_GETFPXREGS = 18, |
| 99 | #define PT_GETFPXREGS PTRACE_GETFPXREGS |
| 100 | |
| 101 | /* Set all extended floating point registers used by a processes. */ |
| 102 | PTRACE_SETFPXREGS = 19, |
| 103 | #define PT_SETFPXREGS PTRACE_SETFPXREGS |
| 104 | |
| 105 | /* Continue and stop at the next entry to or return from syscall. */ |
| 106 | PTRACE_SYSCALL = 24, |
| 107 | #define PT_SYSCALL PTRACE_SYSCALL |
| 108 | |
| 109 | /* Get a TLS entry in the GDT. */ |
| 110 | PTRACE_GET_THREAD_AREA = 25, |
| 111 | #define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA |
| 112 | |
| 113 | /* Change a TLS entry in the GDT. */ |
| 114 | PTRACE_SET_THREAD_AREA = 26, |
| 115 | #define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA |
| 116 | |
| 117 | #ifdef __x86_64__ |
| 118 | /* Access TLS data. */ |
| 119 | PTRACE_ARCH_PRCTL = 30, |
| 120 | # define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL |
| 121 | #endif |
| 122 | |
| 123 | /* Continue and stop at the next syscall, it will not be executed. */ |
| 124 | PTRACE_SYSEMU = 31, |
| 125 | #define PT_SYSEMU PTRACE_SYSEMU |
| 126 | |
| 127 | /* Single step the process, the next syscall will not be executed. */ |
| 128 | PTRACE_SYSEMU_SINGLESTEP = 32, |
| 129 | #define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP |
| 130 | |
| 131 | /* Execute process until next taken branch. */ |
| 132 | PTRACE_SINGLEBLOCK = 33, |
| 133 | #define PT_STEPBLOCK PTRACE_SINGLEBLOCK |
| 134 | |
| 135 | /* Set ptrace filter options. */ |
| 136 | PTRACE_SETOPTIONS = 0x4200, |
| 137 | #define PT_SETOPTIONS PTRACE_SETOPTIONS |
| 138 | |
| 139 | /* Get last ptrace message. */ |
| 140 | PTRACE_GETEVENTMSG = 0x4201, |
| 141 | #define PT_GETEVENTMSG PTRACE_GETEVENTMSG |
| 142 | |
| 143 | /* Get siginfo for process. */ |
| 144 | PTRACE_GETSIGINFO = 0x4202, |
| 145 | #define PT_GETSIGINFO PTRACE_GETSIGINFO |
| 146 | |
| 147 | /* Set new siginfo for process. */ |
| 148 | PTRACE_SETSIGINFO = 0x4203, |
| 149 | #define PT_SETSIGINFO PTRACE_SETSIGINFO |
| 150 | |
| 151 | /* Get register content. */ |
| 152 | PTRACE_GETREGSET = 0x4204, |
| 153 | #define PTRACE_GETREGSET PTRACE_GETREGSET |
| 154 | |
| 155 | /* Set register content. */ |
| 156 | PTRACE_SETREGSET = 0x4205, |
| 157 | #define PTRACE_SETREGSET PTRACE_SETREGSET |
| 158 | |
| 159 | /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect |
| 160 | signal or group stop state. */ |
| 161 | PTRACE_SEIZE = 0x4206, |
| 162 | #define PTRACE_SEIZE PTRACE_SEIZE |
| 163 | |
| 164 | /* Trap seized tracee. */ |
| 165 | PTRACE_INTERRUPT = 0x4207, |
| 166 | #define PTRACE_INTERRUPT PTRACE_INTERRUPT |
| 167 | |
| 168 | /* Wait for next group event. */ |
| 169 | PTRACE_LISTEN = 0x4208, |
| 170 | #define PTRACE_LISTEN PTRACE_LISTEN |
| 171 | |
| 172 | /* Retrieve siginfo_t structures without removing signals from a queue. */ |
| 173 | PTRACE_PEEKSIGINFO = 0x4209, |
| 174 | #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO |
| 175 | |
| 176 | /* Get the mask of blocked signals. */ |
| 177 | PTRACE_GETSIGMASK = 0x420a, |
| 178 | #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK |
| 179 | |
| 180 | /* Change the mask of blocked signals. */ |
| 181 | PTRACE_SETSIGMASK = 0x420b, |
| 182 | #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK |
| 183 | |
| 184 | /* Get seccomp BPF filters. */ |
| 185 | PTRACE_SECCOMP_GET_FILTER = 0x420c, |
| 186 | #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER |
| 187 | |
| 188 | /* Get seccomp BPF filter metadata. */ |
| 189 | PTRACE_SECCOMP_GET_METADATA = 0x420d, |
| 190 | #define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA |
| 191 | |
| 192 | /* Get information about system call. */ |
| 193 | PTRACE_GET_SYSCALL_INFO = 0x420e, |
| 194 | #define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO |
| 195 | |
| 196 | /* Get rseq configuration information. */ |
| 197 | PTRACE_GET_RSEQ_CONFIGURATION = 0x420f |
| 198 | #define PTRACE_GET_RSEQ_CONFIGURATION PTRACE_GET_RSEQ_CONFIGURATION |
| 199 | }; |
| 200 | |
| 201 | |
| 202 | #include <bits/ptrace-shared.h> |
| 203 | |
| 204 | __END_DECLS |
| 205 | |
| 206 | #endif /* _SYS_PTRACE_H */ |
| 207 | |