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

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