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

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