9faadbe
Index: gdb-7.11.90.20160807/gdb/config/i386/linux64.mh
dd46ae6
===================================================================
9faadbe
--- gdb-7.11.90.20160807.orig/gdb/config/i386/linux64.mh	2016-08-07 22:27:13.889285274 +0200
9faadbe
+++ gdb-7.11.90.20160807/gdb/config/i386/linux64.mh	2016-08-07 22:29:20.451311124 +0200
c16b445
@@ -7,7 +7,7 @@
2c55a54
 	linux-procfs.o linux-ptrace.o linux-btrace.o \
32f92b2
 	linux-waitpid.o linux-personality.o x86-linux.o \
c4c35c2
 	x86-linux-dregs.o amd64-linux-siginfo.o linux-namespaces.o
c874340
-NAT_FILE= config/nm-linux.h
c874340
+NAT_FILE= nm-linux64.h
dd46ae6
 NAT_CDEPS = $(srcdir)/proc-service.list
c874340
 
c874340
 # The dynamically loaded libthread_db needs access to symbols in the
9faadbe
Index: gdb-7.11.90.20160807/gdb/config/i386/linux.mh
3b55f78
===================================================================
9faadbe
--- gdb-7.11.90.20160807.orig/gdb/config/i386/linux.mh	2016-08-07 22:27:13.889285274 +0200
9faadbe
+++ gdb-7.11.90.20160807/gdb/config/i386/linux.mh	2016-08-07 22:29:20.451311124 +0200
5752ad0
@@ -1,6 +1,6 @@
5752ad0
 # Host: Intel 386 running GNU/Linux.
5752ad0
 
5752ad0
-NAT_FILE= config/nm-linux.h
5752ad0
+NAT_FILE= nm-linux.h
5752ad0
 NATDEPFILES= inf-ptrace.o fork-child.o \
2f7f533
 	x86-nat.o x86-dregs.o i386-linux-nat.o x86-linux-nat.o \
5752ad0
 	proc-service.o linux-thread-db.o \
9faadbe
Index: gdb-7.11.90.20160807/gdb/config/i386/nm-linux.h
3b55f78
===================================================================
5752ad0
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
9faadbe
+++ gdb-7.11.90.20160807/gdb/config/i386/nm-linux.h	2016-08-07 22:29:20.451311124 +0200
5752ad0
@@ -0,0 +1,28 @@
5752ad0
+/* Native support for GNU/Linux i386.
5752ad0
+
5752ad0
+   Copyright 2010 Free Software Foundation, Inc.
5752ad0
+
5752ad0
+   This file is part of GDB.
5752ad0
+
5752ad0
+   This program is free software; you can redistribute it and/or modify
5752ad0
+   it under the terms of the GNU General Public License as published by
5752ad0
+   the Free Software Foundation; either version 3 of the License, or
5752ad0
+   (at your option) any later version.
5752ad0
+
5752ad0
+   This program is distributed in the hope that it will be useful,
5752ad0
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5752ad0
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5752ad0
+   GNU General Public License for more details.
5752ad0
+
5752ad0
+   You should have received a copy of the GNU General Public License
5752ad0
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
5752ad0
+
5752ad0
+#ifndef NM_LINUX_H
5752ad0
+#define NM_LINUX_H
5752ad0
+
5752ad0
+#include "config/nm-linux.h"
5752ad0
+
5752ad0
+/* Red Hat backward compatibility with gdb-6.8.  */
5752ad0
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
5752ad0
+
5752ad0
+#endif /* NM_LINUX64_H */
9faadbe
Index: gdb-7.11.90.20160807/gdb/config/i386/nm-linux64.h
dd46ae6
===================================================================
dd46ae6
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
9faadbe
+++ gdb-7.11.90.20160807/gdb/config/i386/nm-linux64.h	2016-08-07 22:29:20.451311124 +0200
c874340
@@ -0,0 +1,28 @@
c874340
+/* Native support for GNU/Linux amd64.
c874340
+
c874340
+   Copyright 2010 Free Software Foundation, Inc.
c874340
+
c874340
+   This file is part of GDB.
c874340
+
c874340
+   This program is free software; you can redistribute it and/or modify
c874340
+   it under the terms of the GNU General Public License as published by
c874340
+   the Free Software Foundation; either version 3 of the License, or
c874340
+   (at your option) any later version.
c874340
+
c874340
+   This program is distributed in the hope that it will be useful,
c874340
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
c874340
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c874340
+   GNU General Public License for more details.
c874340
+
c874340
+   You should have received a copy of the GNU General Public License
c874340
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
c874340
+
c874340
+#ifndef NM_LINUX64_H
c874340
+#define NM_LINUX64_H
c874340
+
c874340
+#include "config/nm-linux.h"
c874340
+
c874340
+/* Red Hat backward compatibility with gdb-6.8.  */
c874340
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
c874340
+
c874340
+#endif /* NM_LINUX64_H */
9faadbe
Index: gdb-7.11.90.20160807/gdb/target.h
dd46ae6
===================================================================
9faadbe
--- gdb-7.11.90.20160807.orig/gdb/target.h	2016-08-07 22:27:13.889285274 +0200
9faadbe
+++ gdb-7.11.90.20160807/gdb/target.h	2016-08-07 22:29:20.452311132 +0200
9faadbe
@@ -1939,9 +1939,11 @@
7306e88
    one.  OTHERTYPE is the number of watchpoints of other types than
7306e88
    this one used so far.  */
c874340
 
c874340
+#ifndef target_can_use_hardware_watchpoint
c874340
 #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
eb6cb2d
  (*current_target.to_can_use_hw_breakpoint) (&current_target,  \
32f92b2
 					     TYPE, CNT, OTHERTYPE)
c874340
+#endif
c874340
 
b0e03f5
 /* Returns the number of debug registers needed to watch the given
b0e03f5
    memory region, or zero if not supported.  */
9faadbe
Index: gdb-7.11.90.20160807/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
dd46ae6
===================================================================
dd46ae6
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
9faadbe
+++ gdb-7.11.90.20160807/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp	2016-08-07 22:29:20.452311132 +0200
c874340
@@ -0,0 +1,40 @@
c874340
+# Copyright 2009, 2010 Free Software Foundation, Inc.
c874340
+
c874340
+# This program is free software; you can redistribute it and/or modify
c874340
+# it under the terms of the GNU General Public License as published by
c874340
+# the Free Software Foundation; either version 3 of the License, or
c874340
+# (at your option) any later version.
c874340
+#
c874340
+# This program is distributed in the hope that it will be useful,
c874340
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
c874340
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c874340
+# GNU General Public License for more details.
c874340
+#
c874340
+# You should have received a copy of the GNU General Public License
c874340
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
c874340
+
c874340
+# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
c874340
+if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
c874340
+     && ![istarget "ia64-*-*"])
c874340
+    || [target_info exists gdb,no_hardware_watchpoints]} then {
c874340
+    verbose "Skipping watchpoint-hw-before-run test."
c874340
+    return
c874340
+}
c874340
+
c874340
+set test watchpoint-hw-before-run
c874340
+set srcfile watchpoint-hw-hit-once.c
c874340
+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
c874340
+    return -1
c874340
+}
c874340
+
c874340
+gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
c874340
+
c874340
+# `runto_main' or `runto main' would delete the watchpoint created above.
c874340
+
c874340
+if { [gdb_start_cmd] < 0 } {
c874340
+    untested start
c874340
+    return -1
c874340
+}
c874340
+gdb_test "" "main .* at .*" "start"
c874340
+
c16b445
+gdb_test "continue" "Continuing.\r\n\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
9faadbe
Index: gdb-7.11.90.20160807/gdb/breakpoint.c
9faadbe
===================================================================
9faadbe
--- gdb-7.11.90.20160807.orig/gdb/breakpoint.c	2016-08-07 22:33:38.835405458 +0200
9faadbe
+++ gdb-7.11.90.20160807/gdb/breakpoint.c	2016-08-07 22:34:45.023941950 +0200
9faadbe
@@ -14953,7 +14953,7 @@
9faadbe
 
9faadbe
   if (bpt->type == bp_hardware_breakpoint)
9faadbe
     {
9faadbe
-      int i;
9faadbe
+      int i ATTRIBUTE_UNUSED;
9faadbe
       i = hw_breakpoint_used_count ();
9faadbe
       target_resources_ok = 
9faadbe
 	target_can_use_hardware_watchpoint (bp_hardware_breakpoint,