sparc64: add basic support
[uclibc-ng.git] / libc / sysdeps / linux / sparc64 / sys / ptrace.h
blobcd6675d22c7a9cbd52dd54e41d719c1dffa5c994
1 /* `ptrace' debugger support interface. Linux/SPARC version.
2 Copyright (C) 1996-2014 Free Software Foundation, Inc.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #ifndef _SYS_PTRACE_H
19 #define _SYS_PTRACE_H 1
21 #include <features.h>
22 #include <bits/types.h>
24 /* Linux/SPARC kernels up to 2.3.18 do not care much
25 about what namespace polution, so use a kludge now. */
26 #undef PTRACE_GETREGS
27 #undef PTRACE_SETREGS
28 #undef PTRACE_GETFPREGS
29 #undef PTRACE_SETFPREGS
30 #undef PTRACE_READDATA
31 #undef PTRACE_WRITEDATA
32 #undef PTRACE_READTEXT
33 #undef PTRACE_WRITETEXT
34 #undef PTRACE_SUNDETACH
36 __BEGIN_DECLS
38 /* Type of the REQUEST argument to `ptrace.' */
39 enum __ptrace_request
41 /* Indicate that the process making this request should be traced.
42 All signals received by this process can be intercepted by its
43 parent, and its parent can use the other `ptrace' requests. */
44 PTRACE_TRACEME = 0,
45 #define PT_TRACE_ME PTRACE_TRACEME
47 /* Return the word in the process's text space at address ADDR. */
48 PTRACE_PEEKTEXT = 1,
49 #define PT_READ_I PTRACE_PEEKTEXT
51 /* Return the word in the process's data space at address ADDR. */
52 PTRACE_PEEKDATA = 2,
53 #define PT_READ_D PTRACE_PEEKDATA
55 /* Return the word in the process's user area at offset ADDR. */
56 PTRACE_PEEKUSER = 3,
57 #define PT_READ_U PTRACE_PEEKUSER
59 /* Write the word DATA into the process's text space at address ADDR. */
60 PTRACE_POKETEXT = 4,
61 #define PT_WRITE_I PTRACE_POKETEXT
63 /* Write the word DATA into the process's data space at address ADDR. */
64 PTRACE_POKEDATA = 5,
65 #define PT_WRITE_D PTRACE_POKEDATA
67 /* Write the word DATA into the process's user area at offset ADDR. */
68 PTRACE_POKEUSER = 6,
69 #define PT_WRITE_U PTRACE_POKEUSER
71 /* Continue the process. */
72 PTRACE_CONT = 7,
73 #define PT_CONTINUE PTRACE_CONT
75 /* Kill the process. */
76 PTRACE_KILL = 8,
77 #define PT_KILL PTRACE_KILL
79 /* Single step the process.
80 This is not supported on all machines. */
81 PTRACE_SINGLESTEP = 9,
82 #define PT_STEP PTRACE_SINGLESTEP
84 /* Detach from a process attached to with PTRACE_ATTACH. */
85 PTRACE_DETACH = 11,
86 #define PT_DETACH PTRACE_DETACH
88 /* This define is needed for older programs which were
89 trying to work around sparc-linux ptrace nastiness. */
90 #define PTRACE_SUNDETACH PTRACE_DETACH
92 /* Attach to a process that is already running. */
93 PTRACE_ATTACH = 16,
94 #define PT_ATTACH PTRACE_ATTACH
96 /* Write several bytes at a time. */
97 PTRACE_WRITEDATA = 17,
98 #define PTRACE_WRITEDATA PTRACE_WRITEDATA
100 /* Read several bytes at a time. */
101 PTRACE_READTEXT = 18,
102 #define PTRACE_READTEXT PTRACE_READTEXT
103 #define PTRACE_READDATA PTRACE_READTEXT
105 /* Write several bytes at a time. */
106 PTRACE_WRITETEXT = 19,
107 #define PTRACE_WRITETEXT PTRACE_WRITETEXT
109 /* Get all general purpose registers used by a processes.
110 This is not supported on all machines. */
111 PTRACE_GETREGS = 22,
112 #define PT_GETREGS PTRACE_GETREGS
114 /* Set all general purpose registers used by a processes.
115 This is not supported on all machines. */
116 PTRACE_SETREGS = 23,
117 #define PT_SETREGS PTRACE_SETREGS
119 /* Continue and stop at the next (return from) syscall. */
120 PTRACE_SYSCALL = 24,
121 #define PTRACE_SYSCALL PTRACE_SYSCALL
123 /* Get all floating point registers used by a processes.
124 This is not supported on all machines. */
125 PTRACE_GETFPREGS = 25,
126 #define PT_GETFPREGS PTRACE_GETFPREGS
128 /* Set all floating point registers used by a processes.
129 This is not supported on all machines. */
130 PTRACE_SETFPREGS = 26,
131 #define PT_SETFPREGS PTRACE_SETFPREGS
133 /* Set ptrace filter options. */
134 PTRACE_SETOPTIONS = 0x4200,
135 #define PT_SETOPTIONS PTRACE_SETOPTIONS
137 /* Get last ptrace message. */
138 PTRACE_GETEVENTMSG = 0x4201,
139 #define PT_GETEVENTMSG PTRACE_GETEVENTMSG
141 /* Get siginfo for process. */
142 PTRACE_GETSIGINFO = 0x4202,
143 #define PT_GETSIGINFO PTRACE_GETSIGINFO
145 /* Set new siginfo for process. */
146 PTRACE_SETSIGINFO = 0x4203,
147 #define PT_SETSIGINFO PTRACE_SETSIGINFO
149 /* Get register content. */
150 PTRACE_GETREGSET = 0x4204,
151 #define PTRACE_GETREGSET PTRACE_GETREGSET
153 /* Set register content. */
154 PTRACE_SETREGSET = 0x4205,
155 #define PTRACE_SETREGSET PTRACE_SETREGSET
157 /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
158 signal or group stop state. */
159 PTRACE_SEIZE = 0x4206,
160 #define PTRACE_SEIZE PTRACE_SEIZE
162 /* Trap seized tracee. */
163 PTRACE_INTERRUPT = 0x4207,
164 #define PTRACE_INTERRUPT PTRACE_INTERRUPT
166 /* Wait for next group event. */
167 PTRACE_LISTEN = 0x4208,
168 #define PTRACE_LISTEN PTRACE_LISTEN
170 PTRACE_PEEKSIGINFO = 0x4209
171 #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
175 /* Flag for PTRACE_LISTEN. */
176 enum __ptrace_flags
178 PTRACE_SEIZE_DEVEL = 0x80000000
181 /* Options set using PTRACE_SETOPTIONS. */
182 enum __ptrace_setoptions
184 PTRACE_O_TRACESYSGOOD = 0x00000001,
185 PTRACE_O_TRACEFORK = 0x00000002,
186 PTRACE_O_TRACEVFORK = 0x00000004,
187 PTRACE_O_TRACECLONE = 0x00000008,
188 PTRACE_O_TRACEEXEC = 0x00000010,
189 PTRACE_O_TRACEVFORKDONE = 0x00000020,
190 PTRACE_O_TRACEEXIT = 0x00000040,
191 PTRACE_O_TRACESECCOMP = 0x00000080,
192 PTRACE_O_EXITKILL = 0x00100000,
193 PTRACE_O_MASK = 0x001000ff
196 /* Wait extended result codes for the above trace options. */
197 enum __ptrace_eventcodes
199 PTRACE_EVENT_FORK = 1,
200 PTRACE_EVENT_VFORK = 2,
201 PTRACE_EVENT_CLONE = 3,
202 PTRACE_EVENT_EXEC = 4,
203 PTRACE_EVENT_VFORK_DONE = 5,
204 PTRACE_EVENT_EXIT = 6,
205 PTRACE_EVENT_SECCOMP = 7
208 /* Arguments for PTRACE_PEEKSIGINFO. */
209 struct __ptrace_peeksiginfo_args
211 __uint64_t off; /* From which siginfo to start. */
212 __uint32_t flags; /* Flags for peeksiginfo. */
213 __int32_t nr; /* How many siginfos to take. */
216 enum __ptrace_peeksiginfo_flags
218 /* Read signals from a shared (process wide) queue. */
219 PTRACE_PEEKSIGINFO_SHARED = (1 << 0)
222 /* Perform process tracing functions. REQUEST is one of the values
223 above, and determines the action to be taken.
224 For all requests except PTRACE_TRACEME, PID specifies the process to be
225 traced.
227 PID and the other arguments described above for the various requests should
228 appear (those that are used for the particular request) as:
229 pid_t PID, void *ADDR, int DATA, void *ADDR2
230 after REQUEST. */
231 extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
233 __END_DECLS
235 #endif /* _SYS_PTRACE_H */