Blame SOURCES/gdb-bz541866-rwatch-before-run.patch

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