1 /* `ptrace' debugger support interface. Linux/ia64 version.
2 Copyright (C) 2001-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/>. */
20 #define _SYS_PTRACE_H 1
23 #include <sys/ucontext.h>
24 #include <bits/sigcontext.h>
25 #include <bits/types.h>
29 /* Type of the REQUEST argument to `ptrace.' */
32 /* Indicate that the process making this request should be traced.
33 All signals received by this process can be intercepted by its
34 parent, and its parent can use the other `ptrace' requests. */
36 #define PT_TRACE_ME PTRACE_TRACEME
38 /* Return the word in the process's text space at address ADDR. */
40 #define PT_READ_I PTRACE_PEEKTEXT
42 /* Return the word in the process's data space at address ADDR. */
44 #define PT_READ_D PTRACE_PEEKDATA
46 /* Return the word in the process's user area at offset ADDR. */
48 #define PT_READ_U PTRACE_PEEKUSER
50 /* Write the word DATA into the process's text space at address ADDR. */
52 #define PT_WRITE_I PTRACE_POKETEXT
54 /* Write the word DATA into the process's data space at address ADDR. */
56 #define PT_WRITE_D PTRACE_POKEDATA
58 /* Write the word DATA into the process's user area at offset ADDR. */
60 #define PT_WRITE_U PTRACE_POKEUSER
62 /* Continue the process. */
64 #define PT_CONTINUE PTRACE_CONT
66 /* Kill the process. */
68 #define PT_KILL PTRACE_KILL
70 /* Single step the process.
71 This is not supported on all machines. */
72 PTRACE_SINGLESTEP
= 9,
73 #define PT_STEP PTRACE_SINGLESTEP
75 /* Execute process until next taken branch. */
76 PTRACE_SINGLEBLOCK
= 12,
77 #define PT_STEPBLOCK PTRACE_SINGLEBLOCK
79 /* Attach to a process that is already running. */
81 #define PT_ATTACH PTRACE_ATTACH
83 /* Detach from a process attached to with PTRACE_ATTACH. */
85 #define PT_DETACH PTRACE_DETACH
87 /* Get all registers (pt_all_user_regs) in one shot */
89 #define PT_GETREGS PTRACE_GETREGS
91 /* Set all registers (pt_all_user_regs) in one shot */
93 #define PT_SETREGS PTRACE_SETREGS
95 /* Continue and stop at the next (return from) syscall. */
97 #define PT_SYSCALL PTRACE_SYSCALL
99 /* Set ptrace filter options. */
100 PTRACE_SETOPTIONS
= 0x4200,
101 #define PT_SETOPTIONS PTRACE_SETOPTIONS
103 /* Get last ptrace message. */
104 PTRACE_GETEVENTMSG
= 0x4201,
105 #define PT_GETEVENTMSG PTRACE_GETEVENTMSG
107 /* Get siginfo for process. */
108 PTRACE_GETSIGINFO
= 0x4202,
109 #define PT_GETSIGINFO PTRACE_GETSIGINFO
111 /* Set new siginfo for process. */
112 PTRACE_SETSIGINFO
= 0x4203,
113 #define PT_SETSIGINFO PTRACE_SETSIGINFO
115 /* Get register content. */
116 PTRACE_GETREGSET
= 0x4204,
117 #define PTRACE_GETREGSET PTRACE_GETREGSET
119 /* Set register content. */
120 PTRACE_SETREGSET
= 0x4205,
121 #define PTRACE_SETREGSET PTRACE_SETREGSET
123 /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
124 signal or group stop state. */
125 PTRACE_SEIZE
= 0x4206,
126 #define PTRACE_SEIZE PTRACE_SEIZE
128 /* Trap seized tracee. */
129 PTRACE_INTERRUPT
= 0x4207,
130 #define PTRACE_INTERRUPT PTRACE_INTERRUPT
132 /* Wait for next group event. */
133 PTRACE_LISTEN
= 0x4208,
134 #define PTRACE_LISTEN PTRACE_LISTEN
136 PTRACE_PEEKSIGINFO
= 0x4209,
137 #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
139 PTRACE_GETSIGMASK
= 0x420a,
140 #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
142 PTRACE_SETSIGMASK
= 0x420b,
143 #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
145 PTRACE_SECCOMP_GET_FILTER
= 0x420c
146 #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
150 /* pt_all_user_regs is used for PTRACE_GETREGS/PTRACE_SETREGS. */
151 struct __pt_all_user_regs
154 unsigned long cr_iip
;
156 unsigned long cr_ipsr
;
159 unsigned long gr
[32];
161 unsigned long ar
[128];
162 struct __ia64_fpreg fr
[128];
165 /* Options set using PTRACE_SETOPTIONS. */
166 enum __ptrace_setoptions
168 PTRACE_O_TRACESYSGOOD
= 0x00000001,
169 PTRACE_O_TRACEFORK
= 0x00000002,
170 PTRACE_O_TRACEVFORK
= 0x00000004,
171 PTRACE_O_TRACECLONE
= 0x00000008,
172 PTRACE_O_TRACEEXEC
= 0x00000010,
173 PTRACE_O_TRACEVFORKDONE
= 0x00000020,
174 PTRACE_O_TRACEEXIT
= 0x00000040,
175 PTRACE_O_TRACESECCOMP
= 0x00000080,
176 PTRACE_O_EXITKILL
= 0x00100000,
177 PTRACE_O_SUSPEND_SECCOMP
= 0x00200000,
178 PTRACE_O_MASK
= 0x003000ff
181 enum __ptrace_eventcodes
183 /* Wait extended result codes for the above trace options. */
184 PTRACE_EVENT_FORK
= 1,
185 PTRACE_EVENT_VFORK
= 2,
186 PTRACE_EVENT_CLONE
= 3,
187 PTRACE_EVENT_EXEC
= 4,
188 PTRACE_EVENT_VFORK_DONE
= 5,
189 PTRACE_EVENT_EXIT
= 6,
190 PTRACE_EVENT_SECCOMP
= 7,
191 /* Extended result codes enabled by means other than options. */
192 PTRACE_EVENT_STOP
= 128
195 /* Arguments for PTRACE_PEEKSIGINFO. */
196 struct __ptrace_peeksiginfo_args
198 __uint64_t off
; /* From which siginfo to start. */
199 __uint32_t flags
; /* Flags for peeksiginfo. */
200 __int32_t nr
; /* How many siginfos to take. */
203 enum __ptrace_peeksiginfo_flags
205 /* Read signals from a shared (process wide) queue. */
206 PTRACE_PEEKSIGINFO_SHARED
= (1 << 0)
209 /* Perform process tracing functions. REQUEST is one of the values
210 above, and determines the action to be taken.
211 For all requests except PTRACE_TRACEME, PID specifies the process to be
214 PID and the other arguments described above for the various requests should
215 appear (those that are used for the particular request) as:
216 pid_t PID, void *ADDR, int DATA, void *ADDR2
218 extern long int ptrace (enum __ptrace_request __request
, ...) __THROW
;
222 #endif /* _SYS_PTRACE_H */