1 /* Portable <sys/ptrace.h>
3 Copyright 2004 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., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, 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_READ_I 1 /* Read word in child's I space. */
49 # define PT_READ_D 2 /* Read word in child's D space. */
53 # define PT_READ_U 3 /* Read word in child's U space. */
57 # define PT_WRITE_I 4 /* Write word in child's I space. */
61 # define PT_WRITE_D 5 /* Write word in child's D space. */
65 # define PT_WRITE_U 6 /* Write word in child's U space. */
68 /* HP-UX doesn't define PT_CONTINUE and PT_STEP. Instead of those two
69 ptrace requests, it has PT_CONTIN, PT_CONTIN1, PT_SINGLE and
70 PT_SINGLE1. PT_CONTIN1 and PT_SINGLE1 preserve pending signals,
71 which apparently is what is wanted by the HP-UX native code. */
75 # define PT_CONTINUE PT_CONTIN1
77 # define PT_CONTINUE 7 /* Continue the child. */
82 # define PT_KILL 8 /* Kill the child process. */
87 # define PT_STEP PT_SINGLE1
89 # define PT_STEP 9 /* Single step the child. */
93 /* Not all systems support attaching and detaching. */
97 # define PT_ATTACH PTRACE_ATTACH
102 # ifdef PTRACE_DETACH
103 # define PT_DETACH PTRACE_DETACH
107 /* Some systems, in particular DEC OSF/1, Digital Unix, Compaq Tru64
108 or whatever it's called these days, don't provide a prototype for
109 ptrace. Provide one to silence compiler warnings. */
111 #ifndef HAVE_DECL_PTRACE
112 extern PTRACE_TYPE_RET
ptrace();
115 /* Some systems, at least AIX and HP-UX have a ptrace with five
116 arguments. Since we never use the fifth argument, define a ptrace
117 macro that calls the real ptrace with the last argument set to
120 #ifdef PTRACE_TYPE_ARG5
121 # define ptrace(request, pid, addr, data) ptrace (request, pid, addr, data, 0)
124 #endif /* gdb_ptrace.h */
This page took 0.031209 seconds and 4 git commands to generate.