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

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