Jan Kratochvil 9faadbe
Index: gdb-7.11.90.20160807/gdb/config/i386/linux64.mh
dd46ae6
===================================================================
Jan Kratochvil 9faadbe
--- gdb-7.11.90.20160807.orig/gdb/config/i386/linux64.mh	2016-08-07 22:27:13.889285274 +0200
Jan Kratochvil 9faadbe
+++ gdb-7.11.90.20160807/gdb/config/i386/linux64.mh	2016-08-07 22:29:20.451311124 +0200
Jan Kratochvil c16b445
@@ -7,7 +7,7 @@
Jan Kratochvil 2c55a54
 	linux-procfs.o linux-ptrace.o linux-btrace.o \
Jan Kratochvil 32f92b2
 	linux-waitpid.o linux-personality.o x86-linux.o \
Jan Kratochvil 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
Jan Kratochvil 9faadbe
Index: gdb-7.11.90.20160807/gdb/config/i386/linux.mh
Jan Kratochvil 3b55f78
===================================================================
Jan Kratochvil 9faadbe
--- gdb-7.11.90.20160807.orig/gdb/config/i386/linux.mh	2016-08-07 22:27:13.889285274 +0200
Jan Kratochvil 9faadbe
+++ gdb-7.11.90.20160807/gdb/config/i386/linux.mh	2016-08-07 22:29:20.451311124 +0200
Jan Kratochvil 5752ad0
@@ -1,6 +1,6 @@
Jan Kratochvil 5752ad0
 # Host: Intel 386 running GNU/Linux.
Jan Kratochvil 5752ad0
 
Jan Kratochvil 5752ad0
-NAT_FILE= config/nm-linux.h
Jan Kratochvil 5752ad0
+NAT_FILE= nm-linux.h
Jan Kratochvil 5752ad0
 NATDEPFILES= inf-ptrace.o fork-child.o \
Jan Kratochvil 2f7f533
 	x86-nat.o x86-dregs.o i386-linux-nat.o x86-linux-nat.o \
Jan Kratochvil 5752ad0
 	proc-service.o linux-thread-db.o \
Jan Kratochvil 9faadbe
Index: gdb-7.11.90.20160807/gdb/config/i386/nm-linux.h
Jan Kratochvil 3b55f78
===================================================================
Jan Kratochvil 5752ad0
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
Jan Kratochvil 9faadbe
+++ gdb-7.11.90.20160807/gdb/config/i386/nm-linux.h	2016-08-07 22:29:20.451311124 +0200
Jan Kratochvil 5752ad0
@@ -0,0 +1,28 @@
Jan Kratochvil 5752ad0
+/* Native support for GNU/Linux i386.
Jan Kratochvil 5752ad0
+
Jan Kratochvil 5752ad0
+   Copyright 2010 Free Software Foundation, Inc.
Jan Kratochvil 5752ad0
+
Jan Kratochvil 5752ad0
+   This file is part of GDB.
Jan Kratochvil 5752ad0
+
Jan Kratochvil 5752ad0
+   This program is free software; you can redistribute it and/or modify
Jan Kratochvil 5752ad0
+   it under the terms of the GNU General Public License as published by
Jan Kratochvil 5752ad0
+   the Free Software Foundation; either version 3 of the License, or
Jan Kratochvil 5752ad0
+   (at your option) any later version.
Jan Kratochvil 5752ad0
+
Jan Kratochvil 5752ad0
+   This program is distributed in the hope that it will be useful,
Jan Kratochvil 5752ad0
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
Jan Kratochvil 5752ad0
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Jan Kratochvil 5752ad0
+   GNU General Public License for more details.
Jan Kratochvil 5752ad0
+
Jan Kratochvil 5752ad0
+   You should have received a copy of the GNU General Public License
Jan Kratochvil 5752ad0
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Jan Kratochvil 5752ad0
+
Jan Kratochvil 5752ad0
+#ifndef NM_LINUX_H
Jan Kratochvil 5752ad0
+#define NM_LINUX_H
Jan Kratochvil 5752ad0
+
Jan Kratochvil 5752ad0
+#include "config/nm-linux.h"
Jan Kratochvil 5752ad0
+
Jan Kratochvil 5752ad0
+/* Red Hat backward compatibility with gdb-6.8.  */
Jan Kratochvil 5752ad0
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
Jan Kratochvil 5752ad0
+
Jan Kratochvil 5752ad0
+#endif /* NM_LINUX64_H */
Jan Kratochvil 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
Jan Kratochvil 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 */
Jan Kratochvil 9faadbe
Index: gdb-7.11.90.20160807/gdb/target.h
dd46ae6
===================================================================
Jan Kratochvil 9faadbe
--- gdb-7.11.90.20160807.orig/gdb/target.h	2016-08-07 22:27:13.889285274 +0200
Jan Kratochvil 9faadbe
+++ gdb-7.11.90.20160807/gdb/target.h	2016-08-07 22:29:20.452311132 +0200
Jan Kratochvil 9faadbe
@@ -1939,9 +1939,11 @@
Jan Kratochvil 7306e88
    one.  OTHERTYPE is the number of watchpoints of other types than
Jan Kratochvil 7306e88
    this one used so far.  */
c874340
 
c874340
+#ifndef target_can_use_hardware_watchpoint
c874340
 #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
Jan Kratochvil eb6cb2d
  (*current_target.to_can_use_hw_breakpoint) (&current_target,  \
Jan Kratochvil 32f92b2
 					     TYPE, CNT, OTHERTYPE)
c874340
+#endif
c874340
 
Jan Kratochvil b0e03f5
 /* Returns the number of debug registers needed to watch the given
Jan Kratochvil b0e03f5
    memory region, or zero if not supported.  */
Jan Kratochvil 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
Jan Kratochvil 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
+
Jan Kratochvil c16b445
+gdb_test "continue" "Continuing.\r\n\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
Jan Kratochvil 9faadbe
Index: gdb-7.11.90.20160807/gdb/breakpoint.c
Jan Kratochvil 9faadbe
===================================================================
Jan Kratochvil 9faadbe
--- gdb-7.11.90.20160807.orig/gdb/breakpoint.c	2016-08-07 22:33:38.835405458 +0200
Jan Kratochvil 9faadbe
+++ gdb-7.11.90.20160807/gdb/breakpoint.c	2016-08-07 22:34:45.023941950 +0200
Jan Kratochvil 9faadbe
@@ -14953,7 +14953,7 @@
Jan Kratochvil 9faadbe
 
Jan Kratochvil 9faadbe
   if (bpt->type == bp_hardware_breakpoint)
Jan Kratochvil 9faadbe
     {
Jan Kratochvil 9faadbe
-      int i;
Jan Kratochvil 9faadbe
+      int i ATTRIBUTE_UNUSED;
Jan Kratochvil 9faadbe
       i = hw_breakpoint_used_count ();
Jan Kratochvil 9faadbe
       target_resources_ok = 
Jan Kratochvil 9faadbe
 	target_can_use_hardware_watchpoint (bp_hardware_breakpoint,