summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-07-24 14:57:20 +0100
committerPedro Alves <palves@redhat.com>2015-07-24 15:14:47 +0100
commit5826e159863b6cd69953dc01faf7c20414409909 (patch)
treec1100866b74b3bc4ff71f3e2c3c2aa133aa5fe06
parentC++: handle glibc's ptrace(enum __ptrace_request, ...) (diff)
downloadbinutils-gdb-5826e159863b6cd69953dc01faf7c20414409909.tar.gz
binutils-gdb-5826e159863b6cd69953dc01faf7c20414409909.tar.bz2
binutils-gdb-5826e159863b6cd69953dc01faf7c20414409909.zip
Linux: sys/ptrace.h -> nat/gdb_ptrace.h everywhere
So that we pick the enum __ptrace_request fix everywhere. gdb/ChangeLog: 2015-07-24 Pedro Alves <palves@redhat.com> * aarch64-linux-nat.c: Include nat/gdb_ptrace.h instead of sys/ptrace.h. * alpha-linux-nat.c: Likewise. * amd64-linux-nat.c: Likewise. * arm-linux-nat.c: Likewise. * hppa-linux-nat.c: Likewise. * i386-linux-nat.c: Likewise. * ia64-linux-nat.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Likewise. * m32r-linux-nat.c: Likewise. * m68klinux-nat.c: Likewise. * mips-linux-nat.c: Likewise. * nat/linux-btrace.c: Likewise. * nat/linux-ptrace.c: Likewise. * nat/linux-ptrace.h * nat/mips-linux-watch.c: Likewise. * nat/x86-linux-dregs.c: Likewise. * ppc-linux-nat.c: Likewise. * s390-linux-nat.c: Likewise. * spu-linux-nat.c: Likewise. * tilegx-linux-nat.c: Likewise. * x86-linux-nat.c: Likewise. * xtensa-linux-nat.c: Likewise. gdb/gdbserver/ChangeLog: 2015-07-24 Pedro Alves <palves@redhat.c: Likewise.om> * linux-aarch64-low.c: Include nat/gdb_ptrace.h instead of sys/ptrace.h. * linux-arm-low.c: Likewise. * linux-cris-low.c: Likewise. * linux-crisv32-low.c: Likewise. * linux-low.c: Likewise. * linux-m68k-low.c: Likewise. * linux-mips-low.c: Likewise. * linux-nios2-low.c: Likewise. * linux-s390-low.c: Likewise. * linux-sparc-low.c: Likewise. * linux-tic6x-low.c: Likewise. * linux-tile-low.c: Likewise. * linux-x86-low.c: Likewise.
-rw-r--r--gdb/ChangeLog27
-rw-r--r--gdb/aarch64-linux-nat.c2
-rw-r--r--gdb/alpha-linux-nat.c2
-rw-r--r--gdb/amd64-linux-nat.c2
-rw-r--r--gdb/arm-linux-nat.c2
-rw-r--r--gdb/gdbserver/ChangeLog17
-rw-r--r--gdb/gdbserver/linux-aarch64-low.c2
-rw-r--r--gdb/gdbserver/linux-arm-low.c2
-rw-r--r--gdb/gdbserver/linux-cris-low.c2
-rw-r--r--gdb/gdbserver/linux-crisv32-low.c2
-rw-r--r--gdb/gdbserver/linux-low.c2
-rw-r--r--gdb/gdbserver/linux-m68k-low.c2
-rw-r--r--gdb/gdbserver/linux-mips-low.c2
-rw-r--r--gdb/gdbserver/linux-nios2-low.c2
-rw-r--r--gdb/gdbserver/linux-s390-low.c2
-rw-r--r--gdb/gdbserver/linux-sparc-low.c2
-rw-r--r--gdb/gdbserver/linux-tic6x-low.c2
-rw-r--r--gdb/gdbserver/linux-tile-low.c2
-rw-r--r--gdb/gdbserver/linux-x86-low.c3
-rw-r--r--gdb/hppa-linux-nat.c2
-rw-r--r--gdb/i386-linux-nat.c2
-rw-r--r--gdb/ia64-linux-nat.c2
-rw-r--r--gdb/linux-fork.c2
-rw-r--r--gdb/linux-nat.c2
-rw-r--r--gdb/m32r-linux-nat.c2
-rw-r--r--gdb/m68klinux-nat.c2
-rw-r--r--gdb/mips-linux-nat.c2
-rw-r--r--gdb/nat/linux-btrace.c2
-rw-r--r--gdb/nat/linux-ptrace.c1
-rw-r--r--gdb/nat/linux-ptrace.h2
-rw-r--r--gdb/nat/mips-linux-watch.c2
-rw-r--r--gdb/nat/x86-linux-dregs.c2
-rw-r--r--gdb/ppc-linux-nat.c2
-rw-r--r--gdb/s390-linux-nat.c2
-rw-r--r--gdb/spu-linux-nat.c2
-rw-r--r--gdb/tilegx-linux-nat.c2
-rw-r--r--gdb/x86-linux-nat.c2
-rw-r--r--gdb/xtensa-linux-nat.c2
38 files changed, 81 insertions, 35 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 57be70778c5..f6898fc0be7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,32 @@
2015-07-24 Pedro Alves <palves@redhat.com>
+ * aarch64-linux-nat.c: Include nat/gdb_ptrace.h instead of
+ sys/ptrace.h.
+ * alpha-linux-nat.c: Likewise.
+ * amd64-linux-nat.c: Likewise.
+ * arm-linux-nat.c: Likewise.
+ * hppa-linux-nat.c: Likewise.
+ * i386-linux-nat.c: Likewise.
+ * ia64-linux-nat.c: Likewise.
+ * linux-fork.c: Likewise.
+ * linux-nat.c: Likewise.
+ * m32r-linux-nat.c: Likewise.
+ * m68klinux-nat.c: Likewise.
+ * mips-linux-nat.c: Likewise.
+ * nat/linux-btrace.c: Likewise.
+ * nat/linux-ptrace.c: Likewise.
+ * nat/linux-ptrace.h
+ * nat/mips-linux-watch.c: Likewise.
+ * nat/x86-linux-dregs.c: Likewise.
+ * ppc-linux-nat.c: Likewise.
+ * s390-linux-nat.c: Likewise.
+ * spu-linux-nat.c: Likewise.
+ * tilegx-linux-nat.c: Likewise.
+ * x86-linux-nat.c: Likewise.
+ * xtensa-linux-nat.c: Likewise.
+
+2015-07-24 Pedro Alves <palves@redhat.com>
+
* ptrace.m4 (ptrace tests): Test in C++ mode. Try with 'enum
__ptrace_request as first parameter type instead of int.
(PTRACE_TYPE_ARG1): Define.
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index dae0c15d7de..758b30fee07 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -35,7 +35,7 @@
#include "elf/external.h"
#include "elf/common.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/utsname.h>
#include <asm/ptrace.h>
diff --git a/gdb/alpha-linux-nat.c b/gdb/alpha-linux-nat.c
index 52fbdad0555..f735ffcf1cb 100644
--- a/gdb/alpha-linux-nat.c
+++ b/gdb/alpha-linux-nat.c
@@ -23,7 +23,7 @@
#include "alpha-tdep.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <alpha/ptrace.h>
#include <sys/procfs.h>
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 2e1b081b0f4..397f6643c4f 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -23,7 +23,7 @@
#include "regcache.h"
#include "elf/common.h"
#include <sys/uio.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <asm/prctl.h>
#include <sys/reg.h>
#include "gregset.h"
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index f0ab98cace1..ff156d0df5a 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -33,7 +33,7 @@
#include <elf/common.h>
#include <sys/user.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/utsname.h>
#include <sys/procfs.h>
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 664f674aa27..40826ed99ae 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,20 @@
+2015-07-24 Pedro Alves <palves@redhat.c: Likewise.om>
+
+ * linux-aarch64-low.c: Include nat/gdb_ptrace.h instead of
+ sys/ptrace.h.
+ * linux-arm-low.c: Likewise.
+ * linux-cris-low.c: Likewise.
+ * linux-crisv32-low.c: Likewise.
+ * linux-low.c: Likewise.
+ * linux-m68k-low.c: Likewise.
+ * linux-mips-low.c: Likewise.
+ * linux-nios2-low.c: Likewise.
+ * linux-s390-low.c: Likewise.
+ * linux-sparc-low.c: Likewise.
+ * linux-tic6x-low.c: Likewise.
+ * linux-tile-low.c: Likewise.
+ * linux-x86-low.c: Likewise.
+
2015-07-24 Pedro Alves <palves@redhat.com>
* config.in: Regenerate.
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 79eb44c8121..3a47521e14f 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -26,7 +26,7 @@
#include <signal.h>
#include <sys/user.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <asm/ptrace.h>
#include <sys/uio.h>
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index dd77b48ecdc..14c96a3fcb0 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -24,7 +24,7 @@
#ifndef ELFMAG0
#include <elf.h>
#endif
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <signal.h>
/* Defined in auto-generated files. */
diff --git a/gdb/gdbserver/linux-cris-low.c b/gdb/gdbserver/linux-cris-low.c
index 4e5e4c06847..e0bfa1a583b 100644
--- a/gdb/gdbserver/linux-cris-low.c
+++ b/gdb/gdbserver/linux-cris-low.c
@@ -18,7 +18,7 @@
#include "server.h"
#include "linux-low.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
/* Defined in auto-generated file reg-cris.c. */
void init_registers_cris (void);
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index 65e6c09df27..51208638d97 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -18,7 +18,7 @@
#include "server.h"
#include "linux-low.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
/* Defined in auto-generated file reg-crisv32.c. */
void init_registers_crisv32 (void);
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 7b4318702a6..9bc9fa37c4f 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -26,7 +26,7 @@
#include "nat/linux-nat.h"
#include "nat/linux-waitpid.h"
#include "gdb_wait.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include "nat/linux-ptrace.h"
#include "nat/linux-procfs.h"
#include "nat/linux-personality.h"
diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdb/gdbserver/linux-m68k-low.c
index 4501904e391..39c9cc5a1f9 100644
--- a/gdb/gdbserver/linux-m68k-low.c
+++ b/gdb/gdbserver/linux-m68k-low.c
@@ -68,7 +68,7 @@ m68k_cannot_fetch_register (int regno)
#ifdef HAVE_PTRACE_GETREGS
#include <sys/procfs.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
static void
m68k_fill_gregset (struct regcache *regcache, void *buf)
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index 1695c4cf0dd..d3b01d61f95 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -19,7 +19,7 @@
#include "server.h"
#include "linux-low.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <endian.h>
#include "nat/mips-linux-watch.h"
diff --git a/gdb/gdbserver/linux-nios2-low.c b/gdb/gdbserver/linux-nios2-low.c
index 7bd3c9795d3..8a7ac28b2b3 100644
--- a/gdb/gdbserver/linux-nios2-low.c
+++ b/gdb/gdbserver/linux-nios2-low.c
@@ -22,7 +22,7 @@
#include "server.h"
#include "linux-low.h"
#include "elf/common.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <endian.h>
#include "gdb_proc_service.h"
#include <asm/ptrace.h>
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c
index 5d4ea1ff45f..8a0a6891433 100644
--- a/gdb/gdbserver/linux-s390-low.c
+++ b/gdb/gdbserver/linux-s390-low.c
@@ -24,7 +24,7 @@
#include "elf/common.h"
#include <asm/ptrace.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/uio.h>
#include <elf.h>
diff --git a/gdb/gdbserver/linux-sparc-low.c b/gdb/gdbserver/linux-sparc-low.c
index 8f5cdbf8ba5..796af8aa576 100644
--- a/gdb/gdbserver/linux-sparc-low.c
+++ b/gdb/gdbserver/linux-sparc-low.c
@@ -19,7 +19,7 @@
#include "server.h"
#include "linux-low.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include "gdb_proc_service.h"
diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c
index 0a0d220c345..a2ac3eec827 100644
--- a/gdb/gdbserver/linux-tic6x-low.c
+++ b/gdb/gdbserver/linux-tic6x-low.c
@@ -22,7 +22,7 @@
#include "server.h"
#include "linux-low.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <endian.h>
#include "gdb_proc_service.h"
diff --git a/gdb/gdbserver/linux-tile-low.c b/gdb/gdbserver/linux-tile-low.c
index 2f72fdb8291..6aaea6a080e 100644
--- a/gdb/gdbserver/linux-tile-low.c
+++ b/gdb/gdbserver/linux-tile-low.c
@@ -21,7 +21,7 @@
#include "linux-low.h"
#include <arch/abi.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
/* Defined in auto-generated file reg-tilegx.c. */
void init_registers_tilegx (void);
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 484eadba054..ec2d9068a0f 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -25,6 +25,7 @@
#include "i387-fp.h"
#include "x86-low.h"
#include "x86-xstate.h"
+#include "nat/gdb_ptrace.h"
#include "gdb_proc_service.h"
/* Don't include elf/common.h if linux/elf.h got included by
@@ -117,7 +118,7 @@ static const char *xmltarget_amd64_linux_no_xml = "@<target>\
#include <sys/reg.h>
#include <sys/procfs.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/uio.h>
#ifndef PTRACE_GET_THREAD_AREA
diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c
index cfadf73c1c0..0694f6128f2 100644
--- a/gdb/hppa-linux-nat.c
+++ b/gdb/hppa-linux-nat.c
@@ -25,7 +25,7 @@
#include "linux-nat.h"
#include <sys/procfs.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <linux/version.h>
#include <asm/ptrace.h>
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 349ce68f5c3..63d2648a221 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -22,7 +22,7 @@
#include "gdbcore.h"
#include "regcache.h"
#include "elf/common.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/uio.h>
#include "gregset.h"
#include "gdb_proc_service.h"
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 31b32487d8b..fc17d81b862 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -27,7 +27,7 @@
#include "linux-nat.h"
#include <signal.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include "gdb_wait.h"
#ifdef HAVE_SYS_REG_H
#include <sys/reg.h>
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 27603b36c94..dbaa36eb4a7 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -30,7 +30,7 @@
#include "gdbthread.h"
#include "source.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include "gdb_wait.h"
#include <dirent.h>
#include <ctype.h>
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index be429f8e4ae..e383d8ad642 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -28,7 +28,7 @@
#include <unistd.h>
#include <sys/syscall.h>
#endif
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include "linux-nat.h"
#include "nat/linux-ptrace.h"
#include "nat/linux-procfs.h"
diff --git a/gdb/m32r-linux-nat.c b/gdb/m32r-linux-nat.c
index e5e867b3491..781bb78b50b 100644
--- a/gdb/m32r-linux-nat.c
+++ b/gdb/m32r-linux-nat.c
@@ -23,7 +23,7 @@
#include "regcache.h"
#include "linux-nat.h"
#include "target.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/user.h>
#include <sys/procfs.h>
diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
index 8f89d7b87ad..e6a4ad946de 100644
--- a/gdb/m68klinux-nat.c
+++ b/gdb/m68klinux-nat.c
@@ -30,7 +30,7 @@
#include <sys/dir.h>
#include <signal.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/user.h>
#include <sys/ioctl.h>
#include <fcntl.h>
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index a36bb6356f1..961cb6f8636 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -32,7 +32,7 @@
#include "gregset.h"
#include <sgidefs.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <asm/ptrace.h>
#include "nat/mips-linux-watch.h"
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 63fcdc83103..88ddc612782 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -33,7 +33,7 @@
#include <unistd.h>
#include <sys/mman.h>
#include <sys/user.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/types.h>
#include <signal.h>
#include <sys/utsname.h>
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index 1a926f93156..f097c8a3622 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -22,6 +22,7 @@
#include "linux-waitpid.h"
#include "buffer.h"
#include "gdb_wait.h"
+#include "gdb_ptrace.h"
/* Stores the ptrace options supported by the running kernel.
A value of -1 means we did not check for features yet. A value
diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
index be6c39528c9..41f668cd93b 100644
--- a/gdb/nat/linux-ptrace.h
+++ b/gdb/nat/linux-ptrace.h
@@ -20,7 +20,7 @@
struct buffer;
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#ifdef __UCLIBC__
#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__))
diff --git a/gdb/nat/mips-linux-watch.c b/gdb/nat/mips-linux-watch.c
index 464f709cc9d..02d83f65bf8 100644
--- a/gdb/nat/mips-linux-watch.c
+++ b/gdb/nat/mips-linux-watch.c
@@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "common-defs.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include "mips-linux-watch.h"
/* Assuming usable watch registers REGS, return the irw_mask of
diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c
index 93898033a66..666d86a6f70 100644
--- a/gdb/nat/x86-linux-dregs.c
+++ b/gdb/nat/x86-linux-dregs.c
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "common-defs.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/user.h>
#include "target/waitstatus.h"
#include "nat/x86-linux.h"
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 4ed03d0204d..751468551e1 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -33,7 +33,7 @@
#include "gdb_wait.h"
#include <fcntl.h>
#include <sys/procfs.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
/* Prototypes for supply_gregset etc. */
#include "gregset.h"
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index cedc505e1bd..94edce8bdb0 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -33,7 +33,7 @@
#include "elf/common.h"
#include <asm/ptrace.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <asm/types.h>
#include <sys/procfs.h>
#include <sys/ucontext.h>
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index a043f53d377..cb182bebcef 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -30,7 +30,7 @@
#include "gdbthread.h"
#include "gdb_bfd.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <asm/ptrace.h>
#include <sys/types.h>
diff --git a/gdb/tilegx-linux-nat.c b/gdb/tilegx-linux-nat.c
index b8f0c76541b..b9ce47ac3fb 100644
--- a/gdb/tilegx-linux-nat.c
+++ b/gdb/tilegx-linux-nat.c
@@ -23,7 +23,7 @@
#include "regcache.h"
#include "linux-nat.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/procfs.h>
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index 04917d08571..34a9257ba31 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -21,7 +21,7 @@
#include "inferior.h"
#include "elf/common.h"
#include "gdb_proc_service.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/user.h>
#include <sys/procfs.h>
#include <sys/uio.h>
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index fa627320d6f..7f530ce7903 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -31,7 +31,7 @@
#include "gdb_wait.h"
#include <fcntl.h>
#include <sys/procfs.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <asm/ptrace.h>
#include "gregset.h"