1 /* Portable <sys/ptrace.h>
3 Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
25 /* The <sys/ptrace.h> header was introduced with 4.4BSD, and provided
26 the PT_* symbolic constants for the ptrace(2) request numbers. The
27 ptrace(2) prototype was added later to the same header on BSD.
28 SunOS and GNU/Linux have slightly different symbolic names for the
29 constants that start with PTRACE_*. System V still doesn't have
30 (and probably never will have) a <sys/ptrace.h> with symbolic
31 constants; the ptrace(2) prototype can be found in <unistd.h>.
32 Fortunately all systems use the same numerical constants for the
33 common ptrace requests. */
37 #elif defined(HAVE_SYS_PTRACE_H)
38 # include <sys/ptrace.h>
41 /* No need to include <unistd.h> since it's already included by
45 # define PT_TRACE_ME 0
49 # define PT_READ_I 1 /* Read word in child's I space. */
53 # define PT_READ_D 2 /* Read word in child's D space. */
57 # define PT_READ_U 3 /* Read word in child's U space. */
61 # define PT_WRITE_I 4 /* Write word in child's I space. */
65 # define PT_WRITE_D 5 /* Write word in child's D space. */
69 # define PT_WRITE_U 6 /* Write word in child's U space. */
72 /* HP-UX doesn't define PT_CONTINUE and PT_STEP. Instead of those two
73 ptrace requests, it has PT_CONTIN, PT_CONTIN1, PT_SINGLE and
74 PT_SINGLE1. PT_CONTIN1 and PT_SINGLE1 preserve pending signals,
75 which apparently is what is wanted by the HP-UX native code. */
79 # define PT_CONTINUE PT_CONTIN1
81 # define PT_CONTINUE 7 /* Continue the child. */
86 # define PT_KILL 8 /* Kill the child process. */
91 # define PT_STEP PT_SINGLE1
93 # define PT_STEP 9 /* Single step the child. */
97 /* Not all systems support attaching and detaching. */
100 # ifdef PTRACE_ATTACH
101 # define PT_ATTACH PTRACE_ATTACH
106 # ifdef PTRACE_DETACH
107 # define PT_DETACH PTRACE_DETACH
111 /* Some systems, in particular DEC OSF/1, Digital Unix, Compaq Tru64
112 or whatever it's called these days, don't provide a prototype for
113 ptrace. Provide one to silence compiler warnings. */
115 #ifndef HAVE_DECL_PTRACE
116 extern PTRACE_TYPE_RET
ptrace();
119 /* Some systems, at least AIX and HP-UX have a ptrace with five
120 arguments. Since we never use the fifth argument, define a ptrace
121 macro that calls the real ptrace with the last argument set to
124 #ifdef PTRACE_TYPE_ARG5
125 # define ptrace(request, pid, addr, data) ptrace (request, pid, addr, data, 0)
128 #endif /* gdb_ptrace.h */
This page took 0.032016 seconds and 4 git commands to generate.