1 /* Portable <sys/ptrace.h>
3 Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 /* The <sys/ptrace.h> header was introduced with 4.4BSD, and provided
25 the PT_* symbolic constants for the ptrace(2) request numbers. The
26 ptrace(2) prototype was added later to the same header on BSD.
27 SunOS and GNU/Linux have slightly different symbolic names for the
28 constants that start with PTRACE_*. System V still doesn't have
29 (and probably never will have) a <sys/ptrace.h> with symbolic
30 constants; the ptrace(2) prototype can be found in <unistd.h>.
31 Fortunately all systems use the same numerical constants for the
32 common ptrace requests. */
36 #elif defined(HAVE_SYS_PTRACE_H)
37 # include <sys/ptrace.h>
40 /* No need to include <unistd.h> since it's already included by
44 # define PT_TRACE_ME 0
48 # define PT_READ_I 1 /* Read word in child's I space. */
52 # define PT_READ_D 2 /* Read word in child's D space. */
56 # define PT_READ_U 3 /* Read word in child's U space. */
60 # define PT_WRITE_I 4 /* Write word in child's I space. */
64 # define PT_WRITE_D 5 /* Write word in child's D space. */
68 # define PT_WRITE_U 6 /* Write word in child's U space. */
71 /* HP-UX doesn't define PT_CONTINUE and PT_STEP. Instead of those two
72 ptrace requests, it has PT_CONTIN, PT_CONTIN1, PT_SINGLE and
73 PT_SINGLE1. PT_CONTIN1 and PT_SINGLE1 preserve pending signals,
74 which apparently is what is wanted by the HP-UX native code. */
78 # define PT_CONTINUE PT_CONTIN1
80 # define PT_CONTINUE 7 /* Continue the child. */
85 # define PT_KILL 8 /* Kill the child process. */
90 # define PT_STEP PT_SINGLE1
92 # define PT_STEP 9 /* Single step the child. */
96 /* Not all systems support attaching and detaching. */
100 # define PT_ATTACH PTRACE_ATTACH
105 # ifdef PTRACE_DETACH
106 # define PT_DETACH PTRACE_DETACH
110 /* For systems such as HP/UX that do not provide PT_SYSCALL, define it
111 here as an alias for PT_CONTINUE. This is what the PT_SYSCALL
112 request is expected to do, in addition to stopping when entering/
113 exiting a system call. Chances are, if the system supports system
114 call tracing, enabling this feature is probably done separately;
115 and there is probably no special request that we would be required
116 to use when resuming the execution of our program. */
118 # ifdef PTRACE_SYSCALL
119 # define PT_SYSCALL PTRACE_SYSCALL
121 # define PT_SYSCALL PT_CONTINUE
125 /* Some systems, in particular DEC OSF/1, Digital Unix, Compaq Tru64
126 or whatever it's called these days, don't provide a prototype for
127 ptrace. Provide one to silence compiler warnings. */
129 #ifndef HAVE_DECL_PTRACE
130 extern PTRACE_TYPE_RET
ptrace();
133 /* Some systems, at least AIX and HP-UX have a ptrace with five
134 arguments. Since we never use the fifth argument, define a ptrace
135 macro that calls the real ptrace with the last argument set to
138 #ifdef PTRACE_TYPE_ARG5
139 # define ptrace(request, pid, addr, data) ptrace (request, pid, addr, data, 0)
142 #endif /* gdb_ptrace.h */
This page took 0.033043 seconds and 4 git commands to generate.