]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/gdb_ptrace.h
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / gdb_ptrace.h
CommitLineData
11003ae3
MK
1/* Portable <sys/ptrace.h>
2
6aba47ca 3 Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
11003ae3
MK
4
5 This file is part of GDB.
6
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.
11
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.
16
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
197e01b6
EZ
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
11003ae3
MK
21
22#ifndef GDB_PTRACE_H
23#define GDB_PTRACE_H
24
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.
277215a6 28 SunOS and GNU/Linux have slightly different symbolic names for the
11003ae3
MK
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. */
34
35#ifdef HAVE_PTRACE_H
36# include <ptrace.h>
37#elif defined(HAVE_SYS_PTRACE_H)
38# include <sys/ptrace.h>
39#endif
40
41/* No need to include <unistd.h> since it's already included by
42 "defs.h". */
43
4b8a1a28
MK
44#ifndef PT_TRACE_ME
45# define PT_TRACE_ME 0
46#endif
47
11003ae3
MK
48#ifndef PT_READ_I
49# define PT_READ_I 1 /* Read word in child's I space. */
50#endif
51
52#ifndef PT_READ_D
53# define PT_READ_D 2 /* Read word in child's D space. */
54#endif
55
56#ifndef PT_READ_U
57# define PT_READ_U 3 /* Read word in child's U space. */
58#endif
59
60#ifndef PT_WRITE_I
61# define PT_WRITE_I 4 /* Write word in child's I space. */
62#endif
63
64#ifndef PT_WRITE_D
65# define PT_WRITE_D 5 /* Write word in child's D space. */
66#endif
67
68#ifndef PT_WRITE_U
69# define PT_WRITE_U 6 /* Write word in child's U space. */
70#endif
71
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. */
76
77#ifndef PT_CONTINUE
78# ifdef PT_CONTIN1
79# define PT_CONTINUE PT_CONTIN1
80# else
81# define PT_CONTINUE 7 /* Continue the child. */
82# endif
83#endif
84
85#ifndef PT_KILL
86# define PT_KILL 8 /* Kill the child process. */
87#endif
88
89#ifndef PT_STEP
90# ifdef PT_SINGLE1
91# define PT_STEP PT_SINGLE1
92# else
93# define PT_STEP 9 /* Single step the child. */
94# endif
95#endif
96
97/* Not all systems support attaching and detaching. */
98
4247cafd
AS
99#ifndef PT_ATTACH
100# ifdef PTRACE_ATTACH
11003ae3
MK
101# define PT_ATTACH PTRACE_ATTACH
102# endif
103#endif
104
105#ifndef PT_DETACH
106# ifdef PTRACE_DETACH
107# define PT_DETACH PTRACE_DETACH
108# endif
109#endif
110
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. */
f1bc22da 114
11003ae3
MK
115#ifndef HAVE_DECL_PTRACE
116extern PTRACE_TYPE_RET ptrace();
117#endif
118
f1bc22da
MK
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
122 zero. */
123
124#ifdef PTRACE_TYPE_ARG5
125# define ptrace(request, pid, addr, data) ptrace (request, pid, addr, data, 0)
126#endif
127
11003ae3 128#endif /* gdb_ptrace.h */