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

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