GDB (API)
|
00001 /* Copyright (C) 2011-2013 Free Software Foundation, Inc. 00002 00003 This file is part of GDB. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00017 00018 #ifndef COMMON_LINUX_PTRACE_H 00019 #define COMMON_LINUX_PTRACE_H 00020 00021 struct buffer; 00022 00023 #include <sys/ptrace.h> 00024 00025 #ifdef __UCLIBC__ 00026 #if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__)) 00027 /* PTRACE_TEXT_ADDR and friends. */ 00028 #include <asm/ptrace.h> 00029 #define HAS_NOMMU 00030 #endif 00031 #endif 00032 00033 #if !defined(PTRACE_TYPE_ARG3) 00034 #define PTRACE_TYPE_ARG3 void * 00035 #endif 00036 00037 #if !defined(PTRACE_TYPE_ARG4) 00038 #define PTRACE_TYPE_ARG4 void * 00039 #endif 00040 00041 #ifndef PTRACE_GETSIGINFO 00042 # define PTRACE_GETSIGINFO 0x4202 00043 # define PTRACE_SETSIGINFO 0x4203 00044 #endif /* PTRACE_GETSIGINF */ 00045 00046 /* If the system headers did not provide the constants, hard-code the normal 00047 values. */ 00048 #ifndef PTRACE_EVENT_FORK 00049 00050 #define PTRACE_SETOPTIONS 0x4200 00051 #define PTRACE_GETEVENTMSG 0x4201 00052 00053 /* options set using PTRACE_SETOPTIONS */ 00054 #define PTRACE_O_TRACESYSGOOD 0x00000001 00055 #define PTRACE_O_TRACEFORK 0x00000002 00056 #define PTRACE_O_TRACEVFORK 0x00000004 00057 #define PTRACE_O_TRACECLONE 0x00000008 00058 #define PTRACE_O_TRACEEXEC 0x00000010 00059 #define PTRACE_O_TRACEVFORKDONE 0x00000020 00060 #define PTRACE_O_TRACEEXIT 0x00000040 00061 00062 /* Wait extended result codes for the above trace options. */ 00063 #define PTRACE_EVENT_FORK 1 00064 #define PTRACE_EVENT_VFORK 2 00065 #define PTRACE_EVENT_CLONE 3 00066 #define PTRACE_EVENT_EXEC 4 00067 #define PTRACE_EVENT_VFORK_DONE 5 00068 #define PTRACE_EVENT_EXIT 6 00069 00070 #endif /* PTRACE_EVENT_FORK */ 00071 00072 #if (defined __bfin__ || defined __frv__ || defined __sh__) \ 00073 && !defined PTRACE_GETFDPIC 00074 #define PTRACE_GETFDPIC 31 00075 #define PTRACE_GETFDPIC_EXEC 0 00076 #define PTRACE_GETFDPIC_INTERP 1 00077 #endif 00078 00079 /* We can't always assume that this flag is available, but all systems 00080 with the ptrace event handlers also have __WALL, so it's safe to use 00081 in some contexts. */ 00082 #ifndef __WALL 00083 #define __WALL 0x40000000 /* Wait for any child. */ 00084 #endif 00085 00086 extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer); 00087 extern void linux_ptrace_init_warnings (void); 00088 extern void linux_enable_event_reporting (pid_t pid); 00089 extern int linux_supports_tracefork (void); 00090 extern int linux_supports_traceclone (void); 00091 extern int linux_supports_tracevforkdone (void); 00092 extern int linux_supports_tracesysgood (void); 00093 00094 #endif /* COMMON_LINUX_PTRACE_H */