1
/* `ptrace' debugger support interface. Linux version.
2
Copyright (C) 1996-1999,2000,2006,2007 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, write to the Free
17
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21
#define _SYS_PTRACE_H 1
27
/* Type of the REQUEST argument to `ptrace.' */
30
/* Indicate that the process making this request should be traced.
31
All signals received by this process can be intercepted by its
32
parent, and its parent can use the other `ptrace' requests. */
34
#define PT_TRACE_ME PTRACE_TRACEME
36
/* Return the word in the process's text space at address ADDR. */
38
#define PT_READ_I PTRACE_PEEKTEXT
40
/* Return the word in the process's data space at address ADDR. */
42
#define PT_READ_D PTRACE_PEEKDATA
44
/* Return the word in the process's user area at offset ADDR. */
46
#define PT_READ_U PTRACE_PEEKUSER
48
/* Write the word DATA into the process's text space at address ADDR. */
50
#define PT_WRITE_I PTRACE_POKETEXT
52
/* Write the word DATA into the process's data space at address ADDR. */
54
#define PT_WRITE_D PTRACE_POKEDATA
56
/* Write the word DATA into the process's user area at offset ADDR. */
58
#define PT_WRITE_U PTRACE_POKEUSER
60
/* Continue the process. */
62
#define PT_CONTINUE PTRACE_CONT
64
/* Kill the process. */
66
#define PT_KILL PTRACE_KILL
68
/* Single step the process.
69
This is not supported on all machines. */
70
PTRACE_SINGLESTEP = 9,
71
#define PT_STEP PTRACE_SINGLESTEP
73
/* Get all general purpose registers used by a processes.
74
This is not supported on all machines. */
76
#define PT_GETREGS PTRACE_GETREGS
78
/* Set all general purpose registers used by a processes.
79
This is not supported on all machines. */
81
#define PT_SETREGS PTRACE_SETREGS
83
/* Get all floating point registers used by a processes.
84
This is not supported on all machines. */
85
PTRACE_GETFPREGS = 14,
86
#define PT_GETFPREGS PTRACE_GETFPREGS
88
/* Set all floating point registers used by a processes.
89
This is not supported on all machines. */
90
PTRACE_SETFPREGS = 15,
91
#define PT_SETFPREGS PTRACE_SETFPREGS
93
/* Attach to a process that is already running. */
95
#define PT_ATTACH PTRACE_ATTACH
97
/* Detach from a process attached to with PTRACE_ATTACH. */
99
#define PT_DETACH PTRACE_DETACH
101
/* Get all extended floating point registers used by a processes.
102
This is not supported on all machines. */
103
PTRACE_GETFPXREGS = 18,
104
#define PT_GETFPXREGS PTRACE_GETFPXREGS
106
/* Set all extended floating point registers used by a processes.
107
This is not supported on all machines. */
108
PTRACE_SETFPXREGS = 19,
109
#define PT_SETFPXREGS PTRACE_SETFPXREGS
111
/* Continue and stop at the next (return from) syscall. */
113
#define PT_SYSCALL PTRACE_SYSCALL
115
/* Obtain the load map of the main program or the interpreter of the
116
ptraced process, depending on whether the addr argument is
117
(void*)0 or (void*)1, respectively. */
119
#define PT_GETDSBT PTRACE_GETDSBT
121
/* Set ptrace filter options. */
122
PTRACE_SETOPTIONS = 0x4200,
123
#define PT_SETOPTIONS PTRACE_SETOPTIONS
125
/* Get last ptrace message. */
126
PTRACE_GETEVENTMSG = 0x4201,
127
#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
129
/* Get siginfo for process. */
130
PTRACE_GETSIGINFO = 0x4202,
131
#define PT_GETSIGINFO PTRACE_GETSIGINFO
133
/* Set new siginfo for process. */
134
PTRACE_SETSIGINFO = 0x4203
135
#define PT_SETSIGINFO PTRACE_SETSIGINFO
138
#define PTRACE_GETDSBT_EXEC ((void*)0) /* [addr] request the executable loadmap */
139
#define PTRACE_GETDSBT_INTERP ((void*)1) /* [addr] request the interpreter loadmap */
141
/* Options set using PTRACE_SETOPTIONS. */
142
enum __ptrace_setoptions {
143
PTRACE_O_TRACESYSGOOD = 0x00000001,
144
PTRACE_O_TRACEFORK = 0x00000002,
145
PTRACE_O_TRACEVFORK = 0x00000004,
146
PTRACE_O_TRACECLONE = 0x00000008,
147
PTRACE_O_TRACEEXEC = 0x00000010,
148
PTRACE_O_TRACEVFORKDONE = 0x00000020,
149
PTRACE_O_TRACEEXIT = 0x00000040,
150
PTRACE_O_MASK = 0x0000007f
153
/* Wait extended result codes for the above trace options. */
154
enum __ptrace_eventcodes {
155
PTRACE_EVENT_FORK = 1,
156
PTRACE_EVENT_VFORK = 2,
157
PTRACE_EVENT_CLONE = 3,
158
PTRACE_EVENT_EXEC = 4,
159
PTRACE_EVENT_VFORK_DONE = 5,
160
PTRACE_EVENT_EXIT = 6
163
/* Perform process tracing functions. REQUEST is one of the values
164
above, and determines the action to be taken.
165
For all requests except PTRACE_TRACEME, PID specifies the process to be
168
PID and the other arguments described above for the various requests should
169
appear (those that are used for the particular request) as:
170
pid_t PID, void *ADDR, int DATA, void *ADDR2
172
extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
176
#endif /* _SYS_PTRACE_H */