2.9
[glibc/nacl-glibc.git] / sysdeps / unix / sysv / linux / sparc / sys / ptrace.h
bloba7b204b33a289c4513f17ad4410fa157206d9fea
1 /* `ptrace' debugger support interface. Linux/SPARC version.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007
3 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #ifndef _SYS_PTRACE_H
22 #define _SYS_PTRACE_H 1
24 #include <features.h>
26 #include <bits/wordsize.h>
28 /* Linux/SPARC kernels up to 2.3.18 do not care much
29 about what namespace polution, so use a kludge now. */
30 #undef PTRACE_GETREGS
31 #undef PTRACE_SETREGS
32 #undef PTRACE_GETFPREGS
33 #undef PTRACE_SETFPREGS
34 #undef PTRACE_READDATA
35 #undef PTRACE_WRITEDATA
36 #undef PTRACE_READTEXT
37 #undef PTRACE_WRITETEXT
38 #undef PTRACE_SUNDETACH
40 __BEGIN_DECLS
42 /* Type of the REQUEST argument to `ptrace.' */
43 enum __ptrace_request
45 /* Indicate that the process making this request should be traced.
46 All signals received by this process can be intercepted by its
47 parent, and its parent can use the other `ptrace' requests. */
48 PTRACE_TRACEME = 0,
49 #define PT_TRACE_ME PTRACE_TRACEME
51 /* Return the word in the process's text space at address ADDR. */
52 PTRACE_PEEKTEXT = 1,
53 #define PT_READ_I PTRACE_PEEKTEXT
55 /* Return the word in the process's data space at address ADDR. */
56 PTRACE_PEEKDATA = 2,
57 #define PT_READ_D PTRACE_PEEKDATA
59 /* Return the word in the process's user area at offset ADDR. */
60 PTRACE_PEEKUSER = 3,
61 #define PT_READ_U PTRACE_PEEKUSER
63 /* Write the word DATA into the process's text space at address ADDR. */
64 PTRACE_POKETEXT = 4,
65 #define PT_WRITE_I PTRACE_POKETEXT
67 /* Write the word DATA into the process's data space at address ADDR. */
68 PTRACE_POKEDATA = 5,
69 #define PT_WRITE_D PTRACE_POKEDATA
71 /* Write the word DATA into the process's user area at offset ADDR. */
72 PTRACE_POKEUSER = 6,
73 #define PT_WRITE_U PTRACE_POKEUSER
75 /* Continue the process. */
76 PTRACE_CONT = 7,
77 #define PT_CONTINUE PTRACE_CONT
79 /* Kill the process. */
80 PTRACE_KILL = 8,
81 #define PT_KILL PTRACE_KILL
83 /* Single step the process.
84 This is not supported on all machines. */
85 PTRACE_SINGLESTEP = 9,
86 #define PT_STEP PTRACE_SINGLESTEP
88 /* Detach from a process attached to with PTRACE_ATTACH. */
89 PTRACE_DETACH = 11,
90 #define PT_DETACH PTRACE_DETACH
92 /* This define is needed for older programs which were
93 trying to work around sparc-linux ptrace nastiness. */
94 #define PTRACE_SUNDETACH PTRACE_DETACH
96 #if __WORDSIZE == 32
98 /* Get all general purpose registers used by a processes.
99 This is not supported on all machines. */
100 PTRACE_GETREGS = 12,
101 #define PT_GETREGS PTRACE_GETREGS
103 /* Set all general purpose registers used by a processes.
104 This is not supported on all machines. */
105 PTRACE_SETREGS = 13,
106 #define PT_SETREGS PTRACE_SETREGS
108 /* Get all floating point registers used by a processes.
109 This is not supported on all machines. */
110 PTRACE_GETFPREGS = 14,
111 #define PT_GETFPREGS PTRACE_GETFPREGS
113 /* Set all floating point registers used by a processes.
114 This is not supported on all machines. */
115 PTRACE_SETFPREGS = 15,
116 #define PT_SETFPREGS PTRACE_SETFPREGS
118 #endif
120 /* Attach to a process that is already running. */
121 PTRACE_ATTACH = 16,
122 #define PT_ATTACH PTRACE_ATTACH
124 /* Write several bytes at a time. */
125 PTRACE_WRITEDATA = 17,
126 #define PTRACE_WRITEDATA PTRACE_WRITEDATA
128 /* Read several bytes at a time. */
129 PTRACE_READTEXT = 18,
130 #define PTRACE_READTEXT PTRACE_READTEXT
131 #define PTRACE_READDATA PTRACE_READTEXT
133 /* Write several bytes at a time. */
134 PTRACE_WRITETEXT = 19,
135 #define PTRACE_WRITETEXT PTRACE_WRITETEXT
137 #if __WORDSIZE == 64
139 /* Get all general purpose registers used by a processes.
140 This is not supported on all machines. */
141 PTRACE_GETREGS = 22,
142 #define PT_GETREGS PTRACE_GETREGS
144 /* Set all general purpose registers used by a processes.
145 This is not supported on all machines. */
146 PTRACE_SETREGS = 23,
147 #define PT_SETREGS PTRACE_SETREGS
149 #endif
151 /* Continue and stop at the next (return from) syscall. */
152 PTRACE_SYSCALL = 24,
153 #define PTRACE_SYSCALL PTRACE_SYSCALL
155 #if __WORDSIZE == 64
157 /* Get all floating point registers used by a processes.
158 This is not supported on all machines. */
159 PTRACE_GETFPREGS = 25,
160 #define PT_GETFPREGS PTRACE_GETFPREGS
162 /* Set all floating point registers used by a processes.
163 This is not supported on all machines. */
164 PTRACE_SETFPREGS = 26,
165 #define PT_SETFPREGS PTRACE_SETFPREGS
167 #endif
169 /* Set ptrace filter options. */
170 PTRACE_SETOPTIONS = 0x4200,
171 #define PT_SETOPTIONS PTRACE_SETOPTIONS
173 /* Get last ptrace message. */
174 PTRACE_GETEVENTMSG = 0x4201,
175 #define PT_GETEVENTMSG PTRACE_GETEVENTMSG
177 /* Get siginfo for process. */
178 PTRACE_GETSIGINFO = 0x4202,
179 #define PT_GETSIGINFO PTRACE_GETSIGINFO
181 /* Set new siginfo for process. */
182 PTRACE_SETSIGINFO = 0x4203
183 #define PT_SETSIGINFO PTRACE_SETSIGINFO
186 /* Options set using PTRACE_SETOPTIONS. */
187 enum __ptrace_setoptions {
188 PTRACE_O_TRACESYSGOOD = 0x00000001,
189 PTRACE_O_TRACEFORK = 0x00000002,
190 PTRACE_O_TRACEVFORK = 0x00000004,
191 PTRACE_O_TRACECLONE = 0x00000008,
192 PTRACE_O_TRACEEXEC = 0x00000010,
193 PTRACE_O_TRACEVFORKDONE = 0x00000020,
194 PTRACE_O_TRACEEXIT = 0x00000040,
195 PTRACE_O_MASK = 0x0000007f
198 /* Wait extended result codes for the above trace options. */
199 enum __ptrace_eventcodes {
200 PTRACE_EVENT_FORK = 1,
201 PTRACE_EVENT_VFORK = 2,
202 PTRACE_EVENT_CLONE = 3,
203 PTRACE_EVENT_EXEC = 4,
204 PTRACE_EVENT_VFORK_DONE = 5,
205 PTRACE_EVENT_EXIT = 6
208 /* Perform process tracing functions. REQUEST is one of the values
209 above, and determines the action to be taken.
210 For all requests except PTRACE_TRACEME, PID specifies the process to be
211 traced.
213 PID and the other arguments described above for the various requests should
214 appear (those that are used for the particular request) as:
215 pid_t PID, void *ADDR, int DATA, void *ADDR2
216 after REQUEST. */
217 extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
219 __END_DECLS
221 #endif /* _SYS_PTRACE_H */