Blame SOURCES/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch

01917d
Index: gdb-7.6.1/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
01917d
===================================================================
01917d
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
01917d
+++ gdb-7.6.1/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp	2016-03-10 22:31:31.152094080 +0100
01917d
@@ -0,0 +1,53 @@
01917d
+# Copyright (C) 2016 Free Software Foundation, Inc.
01917d
+
01917d
+# This program is free software; you can redistribute it and/or modify
01917d
+# it under the terms of the GNU General Public License as published by
01917d
+# the Free Software Foundation; either version 3 of the License, or
01917d
+# (at your option) any later version.
01917d
+#
01917d
+# This program is distributed in the hope that it will be useful,
01917d
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
01917d
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
01917d
+# GNU General Public License for more details.
01917d
+#
01917d
+# You should have received a copy of the GNU General Public License
01917d
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
01917d
+
01917d
+if { [prepare_for_testing rhbz1261564-aarch64-watchpoint.exp "rhbz1261564-aarch64-watchpoint"] } {
01917d
+    return -1
01917d
+}
01917d
+
01917d
+if { ! [ runto main ] } then { return 0 }
01917d
+
01917d
+set test "rwatch aligned.var4"
01917d
+if [istarget "s390*-*-*"] {
01917d
+    gdb_test $test {Target does not support this type of hardware watchpoint\.}
01917d
+    untested "s390* does not support hw read watchpoint" 
01917d
+    return
01917d
+}
01917d
+gdb_test $test "Hardware read watchpoint \[0-9\]+: aligned.var4"
01917d
+
01917d
+proc checkvar { address } {
01917d
+    global gdb_prompt
01917d
+
01917d
+    set test "p &aligned.var$address"
01917d
+    gdb_test_multiple $test $test {
01917d
+	-re " = \\(int \\*\\) 0x\[0-9a-f\]+$address <aligned(\\+\[0-9\]+)?>\r\n$gdb_prompt $" {
01917d
+	    pass $test
01917d
+	}
01917d
+	-re "\r\n$gdb_prompt $" {
01917d
+	    untested "$test (unexpected ELF layout)"
01917d
+	    return 0
01917d
+	}
01917d
+    }
01917d
+    return 1
01917d
+}
01917d
+if ![checkvar "0"] { return }
01917d
+if ![checkvar "4"] { return }
01917d
+if ![checkvar "8"] { return }
01917d
+
01917d
+# Assumes: PPC_PTRACE_GETHWDBGINFO::data_bp_alignment == 8
01917d
+# 'lwz' does read only 4 bytes but the hw watchpoint is 8 bytes wide.
01917d
+setup_xfail "powerpc*-*-*"
01917d
+
01917d
+gdb_continue_to_end
01917d
Index: gdb-7.6.1/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
01917d
===================================================================
01917d
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
01917d
+++ gdb-7.6.1/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c	2016-03-10 22:31:31.152094080 +0100
01917d
@@ -0,0 +1,33 @@
01917d
+/* This testcase is part of GDB, the GNU debugger.
01917d
+
01917d
+   Copyright 2016 Free Software Foundation, Inc.
01917d
+
01917d
+   This program is free software; you can redistribute it and/or modify
01917d
+   it under the terms of the GNU General Public License as published by
01917d
+   the Free Software Foundation; either version 3 of the License, or
01917d
+   (at your option) any later version.
01917d
+
01917d
+   This program is distributed in the hope that it will be useful,
01917d
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
01917d
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
01917d
+   GNU General Public License for more details.
01917d
+
01917d
+   You should have received a copy of the GNU General Public License
01917d
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
01917d
+
01917d
+__attribute__((aligned(16))) struct
01917d
+{
01917d
+  int var0, var4, var8;
01917d
+} aligned;
01917d
+
01917d
+int
01917d
+main (void)
01917d
+{
01917d
+  aligned.var0 = 1;
01917d
+  aligned.var4 = 2;
01917d
+  aligned.var8 = 3;
01917d
+
01917d
+  aligned.var4 = aligned.var0;
01917d
+
01917d
+  return 0;
01917d
+}