2011-04-27 Yao Qi <yao@codesourcery.com>
[external/binutils.git] / gdb / common / linux-ptrace.h
1 /* Copyright (C) 2011 Free Software Foundation, Inc.
2
3    This file is part of GDB.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9
10    This program 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
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18 #ifndef COMMON_LINUX_PTRACE_H
19 #define COMMON_LINUX_PTRACE_H
20
21 #include <sys/ptrace.h>
22
23 #ifndef PTRACE_GETSIGINFO
24 # define PTRACE_GETSIGINFO 0x4202
25 # define PTRACE_SETSIGINFO 0x4203
26 #endif /* PTRACE_GETSIGINF */
27
28 /* If the system headers did not provide the constants, hard-code the normal
29    values.  */
30 #ifndef PTRACE_EVENT_FORK
31
32 #define PTRACE_SETOPTIONS       0x4200
33 #define PTRACE_GETEVENTMSG      0x4201
34
35 /* options set using PTRACE_SETOPTIONS */
36 #define PTRACE_O_TRACESYSGOOD   0x00000001
37 #define PTRACE_O_TRACEFORK      0x00000002
38 #define PTRACE_O_TRACEVFORK     0x00000004
39 #define PTRACE_O_TRACECLONE     0x00000008
40 #define PTRACE_O_TRACEEXEC      0x00000010
41 #define PTRACE_O_TRACEVFORKDONE 0x00000020
42 #define PTRACE_O_TRACEEXIT      0x00000040
43
44 /* Wait extended result codes for the above trace options.  */
45 #define PTRACE_EVENT_FORK       1
46 #define PTRACE_EVENT_VFORK      2
47 #define PTRACE_EVENT_CLONE      3
48 #define PTRACE_EVENT_EXEC       4
49 #define PTRACE_EVENT_VFORK_DONE 5
50 #define PTRACE_EVENT_EXIT       6
51
52 #endif /* PTRACE_EVENT_FORK */
53
54 /* We can't always assume that this flag is available, but all systems
55    with the ptrace event handlers also have __WALL, so it's safe to use
56    in some contexts.  */
57 #ifndef __WALL
58 #define __WALL          0x40000000 /* Wait for any child.  */
59 #endif
60
61 #endif /* COMMON_LINUX_PTRACE_H */