Jan Kratochvil 43e595b
Index: gdb-7.5.91.20130323/gdb/config/i386/linux64.mh
dd46ae6
===================================================================
Jan Kratochvil 43e595b
--- gdb-7.5.91.20130323.orig/gdb/config/i386/linux64.mh	2013-03-11 09:25:58.000000000 +0100
Jan Kratochvil 43e595b
+++ gdb-7.5.91.20130323/gdb/config/i386/linux64.mh	2013-03-23 19:48:37.707761117 +0100
Jan Kratochvil 254f0e9
@@ -4,7 +4,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
Jan Kratochvil 3b55f78
 	linux-nat.o linux-osdata.o \
Jan Kratochvil 254f0e9
 	proc-service.o linux-thread-db.o linux-fork.o \
Jan Kratochvil 43e595b
 	linux-procfs.o linux-ptrace.o linux-btrace.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 43e595b
Index: gdb-7.5.91.20130323/gdb/config/i386/linux.mh
Jan Kratochvil 3b55f78
===================================================================
Jan Kratochvil 43e595b
--- gdb-7.5.91.20130323.orig/gdb/config/i386/linux.mh	2013-03-11 09:25:58.000000000 +0100
Jan Kratochvil 43e595b
+++ gdb-7.5.91.20130323/gdb/config/i386/linux.mh	2013-03-23 19:48:22.757990256 +0100
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 5752ad0
 	i386-nat.o i386-linux-nat.o \
Jan Kratochvil 5752ad0
 	proc-service.o linux-thread-db.o \
Jan Kratochvil 43e595b
Index: gdb-7.5.91.20130323/gdb/config/i386/nm-linux.h
Jan Kratochvil 3b55f78
===================================================================
Jan Kratochvil 5752ad0
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
Jan Kratochvil 43e595b
+++ gdb-7.5.91.20130323/gdb/config/i386/nm-linux.h	2013-03-23 19:48:22.757990256 +0100
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 43e595b
Index: gdb-7.5.91.20130323/gdb/config/i386/nm-linux64.h
dd46ae6
===================================================================
dd46ae6
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
Jan Kratochvil 43e595b
+++ gdb-7.5.91.20130323/gdb/config/i386/nm-linux64.h	2013-03-23 19:48:22.757990256 +0100
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 43e595b
Index: gdb-7.5.91.20130323/gdb/target.h
dd46ae6
===================================================================
Jan Kratochvil 43e595b
--- gdb-7.5.91.20130323.orig/gdb/target.h	2013-03-11 09:50:05.000000000 +0100
Jan Kratochvil 43e595b
+++ gdb-7.5.91.20130323/gdb/target.h	2013-03-23 19:48:22.758990238 +0100
Jan Kratochvil 43e595b
@@ -1563,8 +1563,10 @@ extern char *target_thread_name (struct
c874340
    bp_hardware_breakpoint.  CNT is the number of such watchpoints used so far
c874340
    (including this one?).  OTHERTYPE is who knows what...  */
c874340
 
c874340
+#ifndef target_can_use_hardware_watchpoint
c874340
 #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
c874340
  (*current_target.to_can_use_hw_breakpoint) (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 43e595b
Index: gdb-7.5.91.20130323/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
dd46ae6
===================================================================
dd46ae6
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
Jan Kratochvil 43e595b
+++ gdb-7.5.91.20130323/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp	2013-03-23 19:48:22.758990238 +0100
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
+
c874340
+gdb_test "continue" "Continuing.\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"