Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / unix / sysv / linux / tile / sys / ptrace.h
blob2a5246968fd412a893e289c04206fa4b7ca55d43
1 /* Copyright (C) 2011-2014 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
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 PTRACE_SINGLESTEP = 9,
70 #define PT_STEP PTRACE_SINGLESTEP
72 /* Get all general purpose registers used by a processes. */
73 PTRACE_GETREGS = 12,
74 #define PT_GETREGS PTRACE_GETREGS
76 /* Set all general purpose registers used by a processes. */
77 PTRACE_SETREGS = 13,
78 #define PT_SETREGS PTRACE_SETREGS
80 /* Attach to a process that is already running. */
81 PTRACE_ATTACH = 16,
82 #define PT_ATTACH PTRACE_ATTACH
84 /* Detach from a process attached to with PTRACE_ATTACH. */
85 PTRACE_DETACH = 17,
86 #define PT_DETACH PTRACE_DETACH
88 /* Continue and stop at the next (return from) syscall. */
89 PTRACE_SYSCALL = 24,
90 #define PT_SYSCALL PTRACE_SYSCALL
92 /* Set ptrace filter options. */
93 PTRACE_SETOPTIONS = 0x4200,
94 #define PT_SETOPTIONS PTRACE_SETOPTIONS
96 /* Get last ptrace message. */
97 PTRACE_GETEVENTMSG = 0x4201,
98 #define PT_GETEVENTMSG PTRACE_GETEVENTMSG
100 /* Get siginfo for process. */
101 PTRACE_GETSIGINFO = 0x4202,
102 #define PT_GETSIGINFO PTRACE_GETSIGINFO
104 /* Set new siginfo for process. */
105 PTRACE_SETSIGINFO = 0x4203,
106 #define PT_SETSIGINFO PTRACE_SETSIGINFO
108 /* Set register content. */
109 PTRACE_SETREGSET = 0x4205,
110 #define PTRACE_SETREGSET PTRACE_SETREGSET
112 /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
113 signal or group stop state. */
114 PTRACE_SEIZE = 0x4206,
115 #define PTRACE_SEIZE PTRACE_SEIZE
117 /* Trap seized tracee. */
118 PTRACE_INTERRUPT = 0x4207,
119 #define PTRACE_INTERRUPT PTRACE_INTERRUPT
121 /* Wait for next group event. */
122 PTRACE_LISTEN = 0x4208,
123 #define PTRACE_LISTEN PTRACE_LISTEN
125 PTRACE_PEEKSIGINFO = 0x4209
126 #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
130 /* Options set using PTRACE_SETOPTIONS. */
131 enum __ptrace_setoptions
133 PTRACE_O_TRACESYSGOOD = 0x00000001,
134 PTRACE_O_TRACEFORK = 0x00000002,
135 PTRACE_O_TRACEVFORK = 0x00000004,
136 PTRACE_O_TRACECLONE = 0x00000008,
137 PTRACE_O_TRACEEXEC = 0x00000010,
138 PTRACE_O_TRACEVFORKDONE = 0x00000020,
139 PTRACE_O_TRACEEXIT = 0x00000040,
140 PTRACE_O_TRACESECCOMP = 0x00000080,
141 PTRACE_O_MASK = 0x000000ff
144 /* Wait extended result codes for the above trace options. */
145 enum __ptrace_eventcodes
147 PTRACE_EVENT_FORK = 1,
148 PTRACE_EVENT_VFORK = 2,
149 PTRACE_EVENT_CLONE = 3,
150 PTRACE_EVENT_EXEC = 4,
151 PTRACE_EVENT_VFORK_DONE = 5,
152 PTRACE_EVENT_EXIT = 6,
153 PTRACE_EVENT_SECCOMP = 7
156 /* Arguments for PTRACE_PEEKSIGINFO. */
157 struct ptrace_peeksiginfo_args
159 __uint64_t off; /* From which siginfo to start. */
160 __uint32_t flags; /* Flags for peeksiginfo. */
161 __int32_t nr; /* How many siginfos to take. */
164 enum __ptrace_peeksiginfo_flags
166 /* Read signals from a shared (process wide) queue. */
167 PTRACE_PEEKSIGINFO_SHARED = (1 << 0)
170 /* Perform process tracing functions. REQUEST is one of the values
171 above, and determines the action to be taken.
172 For all requests except PTRACE_TRACEME, PID specifies the process to be
173 traced.
175 PID and the other arguments described above for the various requests should
176 appear (those that are used for the particular request) as:
177 pid_t PID, void *ADDR, int DATA, void *ADDR2
178 after REQUEST. */
179 extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
181 __END_DECLS
183 #endif /* _SYS_PTRACE_H */