linux ttyname: Update a reference to kernel docs for kernel 4.10
[glibc.git] / sysdeps / unix / sysv / linux / sys / ptrace.h
blob6ddd972aad1b7f83d5acca6abca895630a082003
1 /* `ptrace' debugger support interface. Linux version.
2 Copyright (C) 1996-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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 <http://www.gnu.org/licenses/>. */
19 #ifndef _SYS_PTRACE_H
20 #define _SYS_PTRACE_H 1
22 #include <features.h>
23 #include <bits/types.h>
25 __BEGIN_DECLS
27 /* Type of the REQUEST argument to `ptrace.' */
28 enum __ptrace_request
30 /* Indicate that the process making this request should be traced.
31 All signals received by this process can be intercepted by its
32 parent, and its parent can use the other `ptrace' requests. */
33 PTRACE_TRACEME = 0,
34 #define PT_TRACE_ME PTRACE_TRACEME
36 /* Return the word in the process's text space at address ADDR. */
37 PTRACE_PEEKTEXT = 1,
38 #define PT_READ_I PTRACE_PEEKTEXT
40 /* Return the word in the process's data space at address ADDR. */
41 PTRACE_PEEKDATA = 2,
42 #define PT_READ_D PTRACE_PEEKDATA
44 /* Return the word in the process's user area at offset ADDR. */
45 PTRACE_PEEKUSER = 3,
46 #define PT_READ_U PTRACE_PEEKUSER
48 /* Write the word DATA into the process's text space at address ADDR. */
49 PTRACE_POKETEXT = 4,
50 #define PT_WRITE_I PTRACE_POKETEXT
52 /* Write the word DATA into the process's data space at address ADDR. */
53 PTRACE_POKEDATA = 5,
54 #define PT_WRITE_D PTRACE_POKEDATA
56 /* Write the word DATA into the process's user area at offset ADDR. */
57 PTRACE_POKEUSER = 6,
58 #define PT_WRITE_U PTRACE_POKEUSER
60 /* Continue the process. */
61 PTRACE_CONT = 7,
62 #define PT_CONTINUE PTRACE_CONT
64 /* Kill the process. */
65 PTRACE_KILL = 8,
66 #define PT_KILL PTRACE_KILL
68 /* Single step the process.
69 This is not supported on all machines. */
70 PTRACE_SINGLESTEP = 9,
71 #define PT_STEP PTRACE_SINGLESTEP
73 /* Get all general purpose registers used by a processes.
74 This is not supported on all machines. */
75 PTRACE_GETREGS = 12,
76 #define PT_GETREGS PTRACE_GETREGS
78 /* Set all general purpose registers used by a processes.
79 This is not supported on all machines. */
80 PTRACE_SETREGS = 13,
81 #define PT_SETREGS PTRACE_SETREGS
83 /* Get all floating point registers used by a processes.
84 This is not supported on all machines. */
85 PTRACE_GETFPREGS = 14,
86 #define PT_GETFPREGS PTRACE_GETFPREGS
88 /* Set all floating point registers used by a processes.
89 This is not supported on all machines. */
90 PTRACE_SETFPREGS = 15,
91 #define PT_SETFPREGS PTRACE_SETFPREGS
93 /* Attach to a process that is already running. */
94 PTRACE_ATTACH = 16,
95 #define PT_ATTACH PTRACE_ATTACH
97 /* Detach from a process attached to with PTRACE_ATTACH. */
98 PTRACE_DETACH = 17,
99 #define PT_DETACH PTRACE_DETACH
101 /* Get all extended floating point registers used by a processes.
102 This is not supported on all machines. */
103 PTRACE_GETFPXREGS = 18,
104 #define PT_GETFPXREGS PTRACE_GETFPXREGS
106 /* Set all extended floating point registers used by a processes.
107 This is not supported on all machines. */
108 PTRACE_SETFPXREGS = 19,
109 #define PT_SETFPXREGS PTRACE_SETFPXREGS
111 /* Continue and stop at the next (return from) syscall. */
112 PTRACE_SYSCALL = 24,
113 #define PT_SYSCALL PTRACE_SYSCALL
115 /* Set ptrace filter options. */
116 PTRACE_SETOPTIONS = 0x4200,
117 #define PT_SETOPTIONS PTRACE_SETOPTIONS
119 /* Get last ptrace message. */
120 PTRACE_GETEVENTMSG = 0x4201,
121 #define PT_GETEVENTMSG PTRACE_GETEVENTMSG
123 /* Get siginfo for process. */
124 PTRACE_GETSIGINFO = 0x4202,
125 #define PT_GETSIGINFO PTRACE_GETSIGINFO
127 /* Set new siginfo for process. */
128 PTRACE_SETSIGINFO = 0x4203,
129 #define PT_SETSIGINFO PTRACE_SETSIGINFO
131 /* Get register content. */
132 PTRACE_GETREGSET = 0x4204,
133 #define PTRACE_GETREGSET PTRACE_GETREGSET
135 /* Set register content. */
136 PTRACE_SETREGSET = 0x4205,
137 #define PTRACE_SETREGSET PTRACE_SETREGSET
139 /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
140 signal or group stop state. */
141 PTRACE_SEIZE = 0x4206,
142 #define PTRACE_SEIZE PTRACE_SEIZE
144 /* Trap seized tracee. */
145 PTRACE_INTERRUPT = 0x4207,
146 #define PTRACE_INTERRUPT PTRACE_INTERRUPT
148 /* Wait for next group event. */
149 PTRACE_LISTEN = 0x4208,
150 #define PTRACE_LISTEN PTRACE_LISTEN
152 PTRACE_PEEKSIGINFO = 0x4209,
153 #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
155 PTRACE_GETSIGMASK = 0x420a,
156 #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
158 PTRACE_SETSIGMASK = 0x420b,
159 #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
161 PTRACE_SECCOMP_GET_FILTER = 0x420c
162 #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
166 /* Options set using PTRACE_SETOPTIONS. */
167 enum __ptrace_setoptions
169 PTRACE_O_TRACESYSGOOD = 0x00000001,
170 PTRACE_O_TRACEFORK = 0x00000002,
171 PTRACE_O_TRACEVFORK = 0x00000004,
172 PTRACE_O_TRACECLONE = 0x00000008,
173 PTRACE_O_TRACEEXEC = 0x00000010,
174 PTRACE_O_TRACEVFORKDONE = 0x00000020,
175 PTRACE_O_TRACEEXIT = 0x00000040,
176 PTRACE_O_TRACESECCOMP = 0x00000080,
177 PTRACE_O_EXITKILL = 0x00100000,
178 PTRACE_O_SUSPEND_SECCOMP = 0x00200000,
179 PTRACE_O_MASK = 0x003000ff
182 enum __ptrace_eventcodes
184 /* Wait extended result codes for the above trace options. */
185 PTRACE_EVENT_FORK = 1,
186 PTRACE_EVENT_VFORK = 2,
187 PTRACE_EVENT_CLONE = 3,
188 PTRACE_EVENT_EXEC = 4,
189 PTRACE_EVENT_VFORK_DONE = 5,
190 PTRACE_EVENT_EXIT = 6,
191 PTRACE_EVENT_SECCOMP = 7,
192 /* Extended result codes enabled by means other than options. */
193 PTRACE_EVENT_STOP = 128
196 /* Arguments for PTRACE_PEEKSIGINFO. */
197 struct __ptrace_peeksiginfo_args
199 __uint64_t off; /* From which siginfo to start. */
200 __uint32_t flags; /* Flags for peeksiginfo. */
201 __int32_t nr; /* How many siginfos to take. */
204 enum __ptrace_peeksiginfo_flags
206 /* Read signals from a shared (process wide) queue. */
207 PTRACE_PEEKSIGINFO_SHARED = (1 << 0)
210 /* Perform process tracing functions. REQUEST is one of the values
211 above, and determines the action to be taken.
212 For all requests except PTRACE_TRACEME, PID specifies the process to be
213 traced.
215 PID and the other arguments described above for the various requests should
216 appear (those that are used for the particular request) as:
217 pid_t PID, void *ADDR, int DATA, void *ADDR2
218 after REQUEST. */
219 extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
221 __END_DECLS
223 #endif /* _SYS_PTRACE_H */