Update copyright notices with scripts/update-copyrights
[jlayton/glibc.git] / ports / sysdeps / unix / sysv / linux / ia64 / sys / ptrace.h
1 /* `ptrace' debugger support interface.  Linux/ia64 version.
2    Copyright (C) 2001-2014 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    <http://www.gnu.org/licenses/>.  */
18
19 #ifndef _SYS_PTRACE_H
20 #define _SYS_PTRACE_H   1
21
22 #include <features.h>
23 #include <sys/ucontext.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      This is not supported on all machines.  */
71   PTRACE_SINGLESTEP = 9,
72 #define PT_STEP PTRACE_SINGLESTEP
73
74   /* Execute process until next taken branch.  */
75   PTRACE_SINGLEBLOCK = 12,
76 #define PT_STEPBLOCK PTRACE_SINGLEBLOCK
77
78   /* Attach to a process that is already running. */
79   PTRACE_ATTACH = 16,
80 #define PT_ATTACH PTRACE_ATTACH
81
82   /* Detach from a process attached to with PTRACE_ATTACH.  */
83   PTRACE_DETACH = 17,
84 #define PT_DETACH PTRACE_DETACH
85
86   /* Get all registers (pt_all_user_regs) in one shot */
87   PTRACE_GETREGS = 18,
88 #define PT_GETREGS PTRACE_GETREGS
89
90   /* Set all registers (pt_all_user_regs) in one shot */
91   PTRACE_SETREGS = 19,
92 #define PT_SETREGS PTRACE_SETREGS
93
94   /* Continue and stop at the next (return from) syscall.  */
95   PTRACE_SYSCALL = 24,
96 #define PT_SYSCALL PTRACE_SYSCALL
97
98   /* Set ptrace filter options.  */
99   PTRACE_SETOPTIONS = 0x4200,
100 #define PT_SETOPTIONS PTRACE_SETOPTIONS
101
102   /* Get last ptrace message.  */
103   PTRACE_GETEVENTMSG = 0x4201,
104 #define PT_GETEVENTMSG PTRACE_GETEVENTMSG
105
106   /* Get siginfo for process.  */
107   PTRACE_GETSIGINFO = 0x4202,
108 #define PT_GETSIGINFO PTRACE_GETSIGINFO
109
110   /* Set new siginfo for process.  */
111   PTRACE_SETSIGINFO = 0x4203,
112 #define PT_SETSIGINFO PTRACE_SETSIGINFO
113
114   /* Get register content.  */
115   PTRACE_GETREGSET = 0x4204,
116 #define PTRACE_GETREGSET PTRACE_GETREGSET
117
118   /* Set register content.  */
119   PTRACE_SETREGSET = 0x4205,
120 #define PTRACE_SETREGSET PTRACE_SETREGSET
121
122   /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
123      signal or group stop state.  */
124   PTRACE_SEIZE = 0x4206,
125 #define PTRACE_SEIZE PTRACE_SEIZE
126
127   /* Trap seized tracee.  */
128   PTRACE_INTERRUPT = 0x4207,
129 #define PTRACE_INTERRUPT PTRACE_INTERRUPT
130
131   /* Wait for next group event.  */
132   PTRACE_LISTEN = 0x4208,
133 #define PTRACE_LISTEN PTRACE_LISTEN
134
135   PTRACE_PEEKSIGINFO = 0x4209
136 #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
137 };
138
139
140 /* Flag for PTRACE_LISTEN.  */
141 enum __ptrace_flags
142 {
143   PTRACE_SEIZE_DEVEL = 0x80000000
144 };
145
146 /* pt_all_user_regs is used for PTRACE_GETREGS/PTRACE_SETREGS.  */
147 struct pt_all_user_regs
148   {
149     unsigned long nat;
150     unsigned long cr_iip;
151     unsigned long cfm;
152     unsigned long cr_ipsr;
153     unsigned long pr;
154
155     unsigned long gr[32];
156     unsigned long br[8];
157     unsigned long ar[128];
158     struct ia64_fpreg fr[128];
159   };
160
161 /* Options set using PTRACE_SETOPTIONS.  */
162 enum __ptrace_setoptions
163 {
164   PTRACE_O_TRACESYSGOOD = 0x00000001,
165   PTRACE_O_TRACEFORK    = 0x00000002,
166   PTRACE_O_TRACEVFORK   = 0x00000004,
167   PTRACE_O_TRACECLONE   = 0x00000008,
168   PTRACE_O_TRACEEXEC    = 0x00000010,
169   PTRACE_O_TRACEVFORKDONE = 0x00000020,
170   PTRACE_O_TRACEEXIT    = 0x00000040,
171   PTRACE_O_TRACESECCOMP = 0x00000080,
172   PTRACE_O_MASK         = 0x000000ff
173 };
174
175 /* Wait extended result codes for the above trace options.  */
176 enum __ptrace_eventcodes
177 {
178   PTRACE_EVENT_FORK     = 1,
179   PTRACE_EVENT_VFORK    = 2,
180   PTRACE_EVENT_CLONE    = 3,
181   PTRACE_EVENT_EXEC     = 4,
182   PTRACE_EVENT_VFORK_DONE = 5,
183   PTRACE_EVENT_EXIT     = 6,
184   PTRACE_EVENT_SECCOMP  = 7
185 };
186
187 /* Arguments for PTRACE_PEEKSIGINFO.  */
188 struct ptrace_peeksiginfo_args
189 {
190   __uint64_t off;       /* From which siginfo to start.  */
191   __uint32_t flags;     /* Flags for peeksiginfo.  */
192   __int32_t nr;         /* How many siginfos to take.  */
193 };
194
195 enum __ptrace_peeksiginfo_flags
196 {
197   /* Read signals from a shared (process wide) queue.  */
198   PTRACE_PEEKSIGINFO_SHARED = (1 << 0)
199 };
200
201 /* Perform process tracing functions.  REQUEST is one of the values
202    above, and determines the action to be taken.
203    For all requests except PTRACE_TRACEME, PID specifies the process to be
204    traced.
205
206    PID and the other arguments described above for the various requests should
207    appear (those that are used for the particular request) as:
208      pid_t PID, void *ADDR, int DATA, void *ADDR2
209    after REQUEST.  */
210 extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
211
212 __END_DECLS
213
214 #endif /* _SYS_PTRACE_H */