xref: /dflybsd-src/contrib/gdb-7/gdb/common/linux-ptrace.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
1*ef5ccd6cSJohn Marino /* Copyright (C) 2011-2013 Free Software Foundation, Inc.
2a45ae5f8SJohn Marino 
3a45ae5f8SJohn Marino    This file is part of GDB.
4a45ae5f8SJohn Marino 
5a45ae5f8SJohn Marino    This program is free software; you can redistribute it and/or modify
6a45ae5f8SJohn Marino    it under the terms of the GNU General Public License as published by
7a45ae5f8SJohn Marino    the Free Software Foundation; either version 3 of the License, or
8a45ae5f8SJohn Marino    (at your option) any later version.
9a45ae5f8SJohn Marino 
10a45ae5f8SJohn Marino    This program is distributed in the hope that it will be useful,
11a45ae5f8SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
12a45ae5f8SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13a45ae5f8SJohn Marino    GNU General Public License for more details.
14a45ae5f8SJohn Marino 
15a45ae5f8SJohn Marino    You should have received a copy of the GNU General Public License
16a45ae5f8SJohn Marino    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17a45ae5f8SJohn Marino 
18a45ae5f8SJohn Marino #ifndef COMMON_LINUX_PTRACE_H
19a45ae5f8SJohn Marino #define COMMON_LINUX_PTRACE_H
20a45ae5f8SJohn Marino 
21*ef5ccd6cSJohn Marino struct buffer;
22*ef5ccd6cSJohn Marino 
23a45ae5f8SJohn Marino #include <sys/ptrace.h>
24a45ae5f8SJohn Marino 
25a45ae5f8SJohn Marino #ifndef PTRACE_GETSIGINFO
26a45ae5f8SJohn Marino # define PTRACE_GETSIGINFO 0x4202
27a45ae5f8SJohn Marino # define PTRACE_SETSIGINFO 0x4203
28a45ae5f8SJohn Marino #endif /* PTRACE_GETSIGINF */
29a45ae5f8SJohn Marino 
30a45ae5f8SJohn Marino /* If the system headers did not provide the constants, hard-code the normal
31a45ae5f8SJohn Marino    values.  */
32a45ae5f8SJohn Marino #ifndef PTRACE_EVENT_FORK
33a45ae5f8SJohn Marino 
34a45ae5f8SJohn Marino #define PTRACE_SETOPTIONS	0x4200
35a45ae5f8SJohn Marino #define PTRACE_GETEVENTMSG	0x4201
36a45ae5f8SJohn Marino 
37a45ae5f8SJohn Marino /* options set using PTRACE_SETOPTIONS */
38a45ae5f8SJohn Marino #define PTRACE_O_TRACESYSGOOD	0x00000001
39a45ae5f8SJohn Marino #define PTRACE_O_TRACEFORK	0x00000002
40a45ae5f8SJohn Marino #define PTRACE_O_TRACEVFORK	0x00000004
41a45ae5f8SJohn Marino #define PTRACE_O_TRACECLONE	0x00000008
42a45ae5f8SJohn Marino #define PTRACE_O_TRACEEXEC	0x00000010
43a45ae5f8SJohn Marino #define PTRACE_O_TRACEVFORKDONE	0x00000020
44a45ae5f8SJohn Marino #define PTRACE_O_TRACEEXIT	0x00000040
45a45ae5f8SJohn Marino 
46a45ae5f8SJohn Marino /* Wait extended result codes for the above trace options.  */
47a45ae5f8SJohn Marino #define PTRACE_EVENT_FORK	1
48a45ae5f8SJohn Marino #define PTRACE_EVENT_VFORK	2
49a45ae5f8SJohn Marino #define PTRACE_EVENT_CLONE	3
50a45ae5f8SJohn Marino #define PTRACE_EVENT_EXEC	4
51a45ae5f8SJohn Marino #define PTRACE_EVENT_VFORK_DONE	5
52a45ae5f8SJohn Marino #define PTRACE_EVENT_EXIT	6
53a45ae5f8SJohn Marino 
54a45ae5f8SJohn Marino #endif /* PTRACE_EVENT_FORK */
55a45ae5f8SJohn Marino 
56a45ae5f8SJohn Marino #if (defined __bfin__ || defined __frv__ || defined __sh__) \
57a45ae5f8SJohn Marino     && !defined PTRACE_GETFDPIC
58a45ae5f8SJohn Marino #define PTRACE_GETFDPIC		31
59a45ae5f8SJohn Marino #define PTRACE_GETFDPIC_EXEC	0
60a45ae5f8SJohn Marino #define PTRACE_GETFDPIC_INTERP	1
61a45ae5f8SJohn Marino #endif
62a45ae5f8SJohn Marino 
63a45ae5f8SJohn Marino /* We can't always assume that this flag is available, but all systems
64a45ae5f8SJohn Marino    with the ptrace event handlers also have __WALL, so it's safe to use
65a45ae5f8SJohn Marino    in some contexts.  */
66a45ae5f8SJohn Marino #ifndef __WALL
67a45ae5f8SJohn Marino #define __WALL          0x40000000 /* Wait for any child.  */
68a45ae5f8SJohn Marino #endif
69a45ae5f8SJohn Marino 
70*ef5ccd6cSJohn Marino extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer);
71*ef5ccd6cSJohn Marino extern void linux_ptrace_init_warnings (void);
72*ef5ccd6cSJohn Marino 
73a45ae5f8SJohn Marino #endif /* COMMON_LINUX_PTRACE_H */
74