01917d
Index: gdb-7.5.91.20130323/gdb/config/i386/linux64.mh
01917d
===================================================================
01917d
--- gdb-7.5.91.20130323.orig/gdb/config/i386/linux64.mh	2013-03-11 09:25:58.000000000 +0100
01917d
+++ gdb-7.5.91.20130323/gdb/config/i386/linux64.mh	2013-03-23 19:48:37.707761117 +0100
01917d
@@ -4,7 +4,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
01917d
 	linux-nat.o linux-osdata.o \
01917d
 	proc-service.o linux-thread-db.o linux-fork.o \
01917d
 	linux-procfs.o linux-ptrace.o linux-btrace.o
01917d
-NAT_FILE= config/nm-linux.h
01917d
+NAT_FILE= nm-linux64.h
01917d
 NAT_CDEPS = $(srcdir)/proc-service.list
01917d
 
01917d
 # The dynamically loaded libthread_db needs access to symbols in the
01917d
Index: gdb-7.5.91.20130323/gdb/config/i386/linux.mh
01917d
===================================================================
01917d
--- gdb-7.5.91.20130323.orig/gdb/config/i386/linux.mh	2013-03-11 09:25:58.000000000 +0100
01917d
+++ gdb-7.5.91.20130323/gdb/config/i386/linux.mh	2013-03-23 19:48:22.757990256 +0100
01917d
@@ -1,6 +1,6 @@
01917d
 # Host: Intel 386 running GNU/Linux.
01917d
 
01917d
-NAT_FILE= config/nm-linux.h
01917d
+NAT_FILE= nm-linux.h
01917d
 NATDEPFILES= inf-ptrace.o fork-child.o \
01917d
 	i386-nat.o i386-linux-nat.o \
01917d
 	proc-service.o linux-thread-db.o \
01917d
Index: gdb-7.5.91.20130323/gdb/config/i386/nm-linux.h
01917d
===================================================================
01917d
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
01917d
+++ gdb-7.5.91.20130323/gdb/config/i386/nm-linux.h	2013-03-23 19:48:22.757990256 +0100
01917d
@@ -0,0 +1,28 @@
01917d
+/* Native support for GNU/Linux i386.
01917d
+
01917d
+   Copyright 2010 Free Software Foundation, Inc.
01917d
+
01917d
+   This file is part of GDB.
01917d
+
01917d
+   This program is free software; you can redistribute it and/or modify
01917d
+   it under the terms of the GNU General Public License as published by
01917d
+   the Free Software Foundation; either version 3 of the License, or
01917d
+   (at your option) any later version.
01917d
+
01917d
+   This program is distributed in the hope that it will be useful,
01917d
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
01917d
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
01917d
+   GNU General Public License for more details.
01917d
+
01917d
+   You should have received a copy of the GNU General Public License
01917d
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
01917d
+
01917d
+#ifndef NM_LINUX_H
01917d
+#define NM_LINUX_H
01917d
+
01917d
+#include "config/nm-linux.h"
01917d
+
01917d
+/* Red Hat backward compatibility with gdb-6.8.  */
01917d
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
01917d
+
01917d
+#endif /* NM_LINUX64_H */
01917d
Index: gdb-7.5.91.20130323/gdb/config/i386/nm-linux64.h
01917d
===================================================================
01917d
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
01917d
+++ gdb-7.5.91.20130323/gdb/config/i386/nm-linux64.h	2013-03-23 19:48:22.757990256 +0100
01917d
@@ -0,0 +1,28 @@
01917d
+/* Native support for GNU/Linux amd64.
01917d
+
01917d
+   Copyright 2010 Free Software Foundation, Inc.
01917d
+
01917d
+   This file is part of GDB.
01917d
+
01917d
+   This program is free software; you can redistribute it and/or modify
01917d
+   it under the terms of the GNU General Public License as published by
01917d
+   the Free Software Foundation; either version 3 of the License, or
01917d
+   (at your option) any later version.
01917d
+
01917d
+   This program is distributed in the hope that it will be useful,
01917d
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
01917d
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
01917d
+   GNU General Public License for more details.
01917d
+
01917d
+   You should have received a copy of the GNU General Public License
01917d
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
01917d
+
01917d
+#ifndef NM_LINUX64_H
01917d
+#define NM_LINUX64_H
01917d
+
01917d
+#include "config/nm-linux.h"
01917d
+
01917d
+/* Red Hat backward compatibility with gdb-6.8.  */
01917d
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
01917d
+
01917d
+#endif /* NM_LINUX64_H */
01917d
Index: gdb-7.5.91.20130323/gdb/target.h
01917d
===================================================================
01917d
--- gdb-7.5.91.20130323.orig/gdb/target.h	2013-03-11 09:50:05.000000000 +0100
01917d
+++ gdb-7.5.91.20130323/gdb/target.h	2013-03-23 19:48:22.758990238 +0100
01917d
@@ -1563,8 +1563,10 @@ extern char *target_thread_name (struct
01917d
    bp_hardware_breakpoint.  CNT is the number of such watchpoints used so far
01917d
    (including this one?).  OTHERTYPE is who knows what...  */
01917d
 
01917d
+#ifndef target_can_use_hardware_watchpoint
01917d
 #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
01917d
  (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE);
01917d
+#endif
01917d
 
01917d
 /* Returns the number of debug registers needed to watch the given
01917d
    memory region, or zero if not supported.  */
01917d
Index: gdb-7.5.91.20130323/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
01917d
===================================================================
01917d
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
01917d
+++ gdb-7.5.91.20130323/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp	2013-03-23 19:48:22.758990238 +0100
01917d
@@ -0,0 +1,40 @@
01917d
+# Copyright 2009, 2010 Free Software Foundation, Inc.
01917d
+
01917d
+# This program is free software; you can redistribute it and/or modify
01917d
+# it under the terms of the GNU General Public License as published by
01917d
+# the Free Software Foundation; either version 3 of the License, or
01917d
+# (at your option) any later version.
01917d
+#
01917d
+# This program is distributed in the hope that it will be useful,
01917d
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
01917d
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
01917d
+# GNU General Public License for more details.
01917d
+#
01917d
+# You should have received a copy of the GNU General Public License
01917d
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
01917d
+
01917d
+# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
01917d
+if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
01917d
+     && ![istarget "ia64-*-*"])
01917d
+    || [target_info exists gdb,no_hardware_watchpoints]} then {
01917d
+    verbose "Skipping watchpoint-hw-before-run test."
01917d
+    return
01917d
+}
01917d
+
01917d
+set test watchpoint-hw-before-run
01917d
+set srcfile watchpoint-hw-hit-once.c
01917d
+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
01917d
+    return -1
01917d
+}
01917d
+
01917d
+gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
01917d
+
01917d
+# `runto_main' or `runto main' would delete the watchpoint created above.
01917d
+
01917d
+if { [gdb_start_cmd] < 0 } {
01917d
+    untested start
01917d
+    return -1
01917d
+}
01917d
+gdb_test "" "main .* at .*" "start"
01917d
+
01917d
+gdb_test "continue" "Continuing.\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"