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

ed07ac
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
ed07ac
From: Fedora GDB patches <invalid@email.com>
ed07ac
Date: Fri, 27 Oct 2017 21:07:50 +0200
ed07ac
Subject: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
ed07ac
ed07ac
;; [aarch64] Fix hardware watchpoints (RH BZ 1261564).
ed07ac
;;=fedoratest
ed07ac
ed07ac
diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
ed07ac
new file mode 100644
ed07ac
--- /dev/null
ed07ac
+++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
ed07ac
@@ -0,0 +1,33 @@
ed07ac
+/* This testcase is part of GDB, the GNU debugger.
ed07ac
+
ed07ac
+   Copyright 2016 Free Software Foundation, Inc.
ed07ac
+
ed07ac
+   This program is free software; you can redistribute it and/or modify
ed07ac
+   it under the terms of the GNU General Public License as published by
ed07ac
+   the Free Software Foundation; either version 3 of the License, or
ed07ac
+   (at your option) any later version.
ed07ac
+
ed07ac
+   This program is distributed in the hope that it will be useful,
ed07ac
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ed07ac
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ed07ac
+   GNU General Public License for more details.
ed07ac
+
ed07ac
+   You should have received a copy of the GNU General Public License
ed07ac
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
ed07ac
+
ed07ac
+__attribute__((aligned(16))) struct
ed07ac
+{
ed07ac
+  int var0, var4, var8;
ed07ac
+} aligned;
ed07ac
+
ed07ac
+int
ed07ac
+main (void)
ed07ac
+{
ed07ac
+  aligned.var0 = 1;
ed07ac
+  aligned.var4 = 2;
ed07ac
+  aligned.var8 = 3;
ed07ac
+
ed07ac
+  aligned.var4 = aligned.var0;
ed07ac
+
ed07ac
+  return 0;
ed07ac
+}
ed07ac
diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
ed07ac
new file mode 100644
ed07ac
--- /dev/null
ed07ac
+++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
ed07ac
@@ -0,0 +1,53 @@
ed07ac
+# Copyright (C) 2016 Free Software Foundation, Inc.
ed07ac
+
ed07ac
+# This program is free software; you can redistribute it and/or modify
ed07ac
+# it under the terms of the GNU General Public License as published by
ed07ac
+# the Free Software Foundation; either version 3 of the License, or
ed07ac
+# (at your option) any later version.
ed07ac
+#
ed07ac
+# This program is distributed in the hope that it will be useful,
ed07ac
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
ed07ac
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ed07ac
+# GNU General Public License for more details.
ed07ac
+#
ed07ac
+# You should have received a copy of the GNU General Public License
ed07ac
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
ed07ac
+
ed07ac
+if { [prepare_for_testing rhbz1261564-aarch64-watchpoint.exp "rhbz1261564-aarch64-watchpoint"] } {
ed07ac
+    return -1
ed07ac
+}
ed07ac
+
ed07ac
+if { ! [ runto main ] } then { return 0 }
ed07ac
+
ed07ac
+set test "rwatch aligned.var4"
ed07ac
+if [istarget "s390*-*-*"] {
ed07ac
+    gdb_test $test {Target does not support this type of hardware watchpoint\.}
ed07ac
+    untested "s390* does not support hw read watchpoint"
ed07ac
+    return
ed07ac
+}
ed07ac
+gdb_test $test "Hardware read watchpoint \[0-9\]+: aligned.var4"
ed07ac
+
ed07ac
+proc checkvar { address } {
ed07ac
+    global gdb_prompt
ed07ac
+
ed07ac
+    set test "p &aligned.var$address"
ed07ac
+    gdb_test_multiple $test $test {
ed07ac
+	-re " = \\(int \\*\\) 0x\[0-9a-f\]+$address <aligned(\\+\[0-9\]+)?>\r\n$gdb_prompt $" {
ed07ac
+	    pass $test
ed07ac
+	}
ed07ac
+	-re "\r\n$gdb_prompt $" {
ed07ac
+	    untested "$test (unexpected ELF layout)"
ed07ac
+	    return 0
ed07ac
+	}
ed07ac
+    }
ed07ac
+    return 1
ed07ac
+}
ed07ac
+if ![checkvar "0"] { return }
ed07ac
+if ![checkvar "4"] { return }
ed07ac
+if ![checkvar "8"] { return }
ed07ac
+
ed07ac
+# Assumes: PPC_PTRACE_GETHWDBGINFO::data_bp_alignment == 8
ed07ac
+# 'lwz' does read only 4 bytes but the hw watchpoint is 8 bytes wide.
ed07ac
+setup_xfail "powerpc*-*-*"
ed07ac
+
ed07ac
+gdb_continue_to_end