1 |
1325 |
phoenix |
/* `ptrace' debugger support interface. Linux/SPARC version.
|
2 |
|
|
Copyright (C) 1996, 1997, 1998, 1999, 2000 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, write to the Free
|
17 |
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
18 |
|
|
02111-1307 USA. */
|
19 |
|
|
|
20 |
|
|
#ifndef _SYS_PTRACE_H
|
21 |
|
|
#define _SYS_PTRACE_H 1
|
22 |
|
|
|
23 |
|
|
#include <features.h>
|
24 |
|
|
|
25 |
|
|
#include <bits/wordsize.h>
|
26 |
|
|
|
27 |
|
|
/* Linux/SPARC kernels up to 2.3.18 do not care much
|
28 |
|
|
about what namespace polution, so use a kludge now. */
|
29 |
|
|
#undef PTRACE_GETREGS
|
30 |
|
|
#undef PTRACE_SETREGS
|
31 |
|
|
#undef PTRACE_GETFPREGS
|
32 |
|
|
#undef PTRACE_SETFPREGS
|
33 |
|
|
#undef PTRACE_READDATA
|
34 |
|
|
#undef PTRACE_WRITEDATA
|
35 |
|
|
#undef PTRACE_READTEXT
|
36 |
|
|
#undef PTRACE_WRITETEXT
|
37 |
|
|
#undef PTRACE_SUNDETACH
|
38 |
|
|
|
39 |
|
|
__BEGIN_DECLS
|
40 |
|
|
|
41 |
|
|
/* Type of the REQUEST argument to `ptrace.' */
|
42 |
|
|
enum __ptrace_request
|
43 |
|
|
{
|
44 |
|
|
/* Indicate that the process making this request should be traced.
|
45 |
|
|
All signals received by this process can be intercepted by its
|
46 |
|
|
parent, and its parent can use the other `ptrace' requests. */
|
47 |
|
|
PTRACE_TRACEME = 0,
|
48 |
|
|
#define PT_TRACE_ME PTRACE_TRACEME
|
49 |
|
|
|
50 |
|
|
/* Return the word in the process's text space at address ADDR. */
|
51 |
|
|
PTRACE_PEEKTEXT = 1,
|
52 |
|
|
#define PT_READ_I PTRACE_PEEKTEXT
|
53 |
|
|
|
54 |
|
|
/* Return the word in the process's data space at address ADDR. */
|
55 |
|
|
PTRACE_PEEKDATA = 2,
|
56 |
|
|
#define PT_READ_D PTRACE_PEEKDATA
|
57 |
|
|
|
58 |
|
|
/* Return the word in the process's user area at offset ADDR. */
|
59 |
|
|
PTRACE_PEEKUSER = 3,
|
60 |
|
|
#define PT_READ_U PTRACE_PEEKUSER
|
61 |
|
|
|
62 |
|
|
/* Write the word DATA into the process's text space at address ADDR. */
|
63 |
|
|
PTRACE_POKETEXT = 4,
|
64 |
|
|
#define PT_WRITE_I PTRACE_POKETEXT
|
65 |
|
|
|
66 |
|
|
/* Write the word DATA into the process's data space at address ADDR. */
|
67 |
|
|
PTRACE_POKEDATA = 5,
|
68 |
|
|
#define PT_WRITE_D PTRACE_POKEDATA
|
69 |
|
|
|
70 |
|
|
/* Write the word DATA into the process's user area at offset ADDR. */
|
71 |
|
|
PTRACE_POKEUSER = 6,
|
72 |
|
|
#define PT_WRITE_U PTRACE_POKEUSER
|
73 |
|
|
|
74 |
|
|
/* Continue the process. */
|
75 |
|
|
PTRACE_CONT = 7,
|
76 |
|
|
#define PT_CONTINUE PTRACE_CONT
|
77 |
|
|
|
78 |
|
|
/* Kill the process. */
|
79 |
|
|
PTRACE_KILL = 8,
|
80 |
|
|
#define PT_KILL PTRACE_KILL
|
81 |
|
|
|
82 |
|
|
/* Single step the process.
|
83 |
|
|
This is not supported on all machines. */
|
84 |
|
|
PTRACE_SINGLESTEP = 9,
|
85 |
|
|
#define PT_STEP PTRACE_SINGLESTEP
|
86 |
|
|
|
87 |
|
|
/* Detach from a process attached to with PTRACE_ATTACH. */
|
88 |
|
|
PTRACE_DETACH = 11,
|
89 |
|
|
#define PT_DETACH PTRACE_DETACH
|
90 |
|
|
|
91 |
|
|
/* This define is needed for older programs which were
|
92 |
|
|
trying to work around sparc-linux ptrace nastiness. */
|
93 |
|
|
#define PTRACE_SUNDETACH PTRACE_DETACH
|
94 |
|
|
|
95 |
|
|
#if __WORDSIZE == 32
|
96 |
|
|
|
97 |
|
|
/* Get all general purpose registers used by a processes.
|
98 |
|
|
This is not supported on all machines. */
|
99 |
|
|
PTRACE_GETREGS = 12,
|
100 |
|
|
#define PT_GETREGS PTRACE_GETREGS
|
101 |
|
|
|
102 |
|
|
/* Set all general purpose registers used by a processes.
|
103 |
|
|
This is not supported on all machines. */
|
104 |
|
|
PTRACE_SETREGS = 13,
|
105 |
|
|
#define PT_SETREGS PTRACE_SETREGS
|
106 |
|
|
|
107 |
|
|
/* Get all floating point registers used by a processes.
|
108 |
|
|
This is not supported on all machines. */
|
109 |
|
|
PTRACE_GETFPREGS = 14,
|
110 |
|
|
#define PT_GETFPREGS PTRACE_GETFPREGS
|
111 |
|
|
|
112 |
|
|
/* Set all floating point registers used by a processes.
|
113 |
|
|
This is not supported on all machines. */
|
114 |
|
|
PTRACE_SETFPREGS = 15,
|
115 |
|
|
#define PT_SETFPREGS PTRACE_SETFPREGS
|
116 |
|
|
|
117 |
|
|
#endif
|
118 |
|
|
|
119 |
|
|
/* Attach to a process that is already running. */
|
120 |
|
|
PTRACE_ATTACH = 16,
|
121 |
|
|
#define PT_ATTACH PTRACE_ATTACH
|
122 |
|
|
|
123 |
|
|
/* Write several bytes at a time. */
|
124 |
|
|
PTRACE_WRITEDATA = 17,
|
125 |
|
|
#define PTRACE_WRITEDATA PTRACE_WRITEDATA
|
126 |
|
|
|
127 |
|
|
/* Read several bytes at a time. */
|
128 |
|
|
PTRACE_READTEXT = 18,
|
129 |
|
|
#define PTRACE_READTEXT PTRACE_READTEXT
|
130 |
|
|
#define PTRACE_READDATA PTRACE_READTEXT
|
131 |
|
|
|
132 |
|
|
/* Write several bytes at a time. */
|
133 |
|
|
PTRACE_WRITETEXT = 19,
|
134 |
|
|
#define PTRACE_WRITETEXT PTRACE_WRITETEXT
|
135 |
|
|
|
136 |
|
|
#if __WORDSIZE == 64
|
137 |
|
|
|
138 |
|
|
/* Get all general purpose registers used by a processes.
|
139 |
|
|
This is not supported on all machines. */
|
140 |
|
|
PTRACE_GETREGS = 22,
|
141 |
|
|
#define PT_GETREGS PTRACE_GETREGS
|
142 |
|
|
|
143 |
|
|
/* Set all general purpose registers used by a processes.
|
144 |
|
|
This is not supported on all machines. */
|
145 |
|
|
PTRACE_SETREGS = 23,
|
146 |
|
|
#define PT_SETREGS PTRACE_SETREGS
|
147 |
|
|
|
148 |
|
|
#endif
|
149 |
|
|
|
150 |
|
|
/* Continue and stop at the next (return from) syscall. */
|
151 |
|
|
PTRACE_SYSCALL = 24
|
152 |
|
|
#define PTRACE_SYSCALL PTRACE_SYSCALL
|
153 |
|
|
|
154 |
|
|
#if __WORDSIZE == 64
|
155 |
|
|
|
156 |
|
|
,
|
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
|
161 |
|
|
|
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
|
166 |
|
|
|
167 |
|
|
#endif
|
168 |
|
|
};
|
169 |
|
|
|
170 |
|
|
/* Perform process tracing functions. REQUEST is one of the values
|
171 |
|
|
above, and determines the action to be taken.
|
172 |
|
|
For all requests except PTRACE_TRACEME, PID specifies the process to be
|
173 |
|
|
traced.
|
174 |
|
|
|
175 |
|
|
PID and the other arguments described above for the various requests should
|
176 |
|
|
appear (those that are used for the particular request) as:
|
177 |
|
|
pid_t PID, void *ADDR, int DATA, void *ADDR2
|
178 |
|
|
after REQUEST. */
|
179 |
|
|
extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
|
180 |
|
|
|
181 |
|
|
__END_DECLS
|
182 |
|
|
|
183 |
|
|
#endif /* _SYS_PTRACE_H */
|