1 /* `ptrace' debugger support interface.  Linux/ia64 version.
2    Copyright (C) 2001-2022 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    <https://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/sigcontext.h>
25 #include <bits/types.h>
26 
27 __BEGIN_DECLS
28 
29 /* Type of the REQUEST argument to `ptrace.'  */
30 enum __ptrace_request
31 {
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.  */
35   PTRACE_TRACEME = 0,
36 #define PT_TRACE_ME PTRACE_TRACEME
37 
38   /* Return the word in the process's text space at address ADDR.  */
39   PTRACE_PEEKTEXT = 1,
40 #define PT_READ_I PTRACE_PEEKTEXT
41 
42   /* Return the word in the process's data space at address ADDR.  */
43   PTRACE_PEEKDATA = 2,
44 #define PT_READ_D PTRACE_PEEKDATA
45 
46   /* Return the word in the process's user area at offset ADDR.  */
47   PTRACE_PEEKUSER = 3,
48 #define PT_READ_U PTRACE_PEEKUSER
49 
50   /* Write the word DATA into the process's text space at address ADDR.  */
51   PTRACE_POKETEXT = 4,
52 #define PT_WRITE_I PTRACE_POKETEXT
53 
54   /* Write the word DATA into the process's data space at address ADDR.  */
55   PTRACE_POKEDATA = 5,
56 #define PT_WRITE_D PTRACE_POKEDATA
57 
58   /* Write the word DATA into the process's user area at offset ADDR.  */
59   PTRACE_POKEUSER = 6,
60 #define PT_WRITE_U PTRACE_POKEUSER
61 
62   /* Continue the process.  */
63   PTRACE_CONT = 7,
64 #define PT_CONTINUE PTRACE_CONT
65 
66   /* Kill the process.  */
67   PTRACE_KILL = 8,
68 #define PT_KILL PTRACE_KILL
69 
70   /* Single step the process.  */
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 entry to or 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   /* Retrieve siginfo_t structures without removing signals from a queue.  */
136   PTRACE_PEEKSIGINFO = 0x4209,
137 #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
138 
139   /* Get the mask of blocked signals.  */
140   PTRACE_GETSIGMASK = 0x420a,
141 #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
142 
143   /* Change the mask of blocked signals.  */
144   PTRACE_SETSIGMASK = 0x420b,
145 #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
146 
147   /* Get seccomp BPF filters.  */
148   PTRACE_SECCOMP_GET_FILTER = 0x420c,
149 #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
150 
151   /* Get seccomp BPF filter metadata.  */
152   PTRACE_SECCOMP_GET_METADATA = 0x420d,
153 #define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
154 
155   /* Get information about system call.  */
156   PTRACE_GET_SYSCALL_INFO = 0x420e,
157 #define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
158 
159   /* Get rseq configuration information.  */
160   PTRACE_GET_RSEQ_CONFIGURATION = 0x420f
161 #define PTRACE_GET_RSEQ_CONFIGURATION PTRACE_GET_RSEQ_CONFIGURATION
162 };
163 
164 
165 /* pt_all_user_regs is used for PTRACE_GETREGS/PTRACE_SETREGS.  */
166 struct __pt_all_user_regs
167   {
168     unsigned long nat;
169     unsigned long cr_iip;
170     unsigned long cfm;
171     unsigned long cr_ipsr;
172     unsigned long pr;
173 
174     unsigned long gr[32];
175     unsigned long br[8];
176     unsigned long ar[128];
177     struct __ia64_fpreg fr[128];
178   };
179 
180 #include <bits/ptrace-shared.h>
181 
182 __END_DECLS
183 
184 #endif /* _SYS_PTRACE_H */
185