Blame SOURCES/gdb-6.8-watchpoint-conditionals-test.patch

190f2a
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
190f2a
From: Fedora GDB patches <invalid@email.com>
190f2a
Date: Fri, 27 Oct 2017 21:07:50 +0200
190f2a
Subject: gdb-6.8-watchpoint-conditionals-test.patch
190f2a
190f2a
;; Test the watchpoints conditionals works.
190f2a
;;=fedoratest
190f2a
190f2a
For:
190f2a
http://sourceware.org/ml/gdb-patches/2008-04/msg00379.html
190f2a
http://sourceware.org/ml/gdb-cvs/2008-04/msg00104.html
190f2a
190f2a
diff --git a/gdb/testsuite/gdb.base/watchpoint-cond.c b/gdb/testsuite/gdb.base/watchpoint-cond.c
190f2a
new file mode 100644
190f2a
--- /dev/null
190f2a
+++ b/gdb/testsuite/gdb.base/watchpoint-cond.c
190f2a
@@ -0,0 +1,31 @@
190f2a
+/* This testcase is part of GDB, the GNU debugger.
190f2a
+
190f2a
+   Copyright 2008 Free Software Foundation, Inc.
190f2a
+
190f2a
+   This program is free software; you can redistribute it and/or modify
190f2a
+   it under the terms of the GNU General Public License as published by
190f2a
+   the Free Software Foundation; either version 3 of the License, or
190f2a
+   (at your option) any later version.
190f2a
+
190f2a
+   This program is distributed in the hope that it will be useful,
190f2a
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
190f2a
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
190f2a
+   GNU General Public License for more details.
190f2a
+
190f2a
+   You should have received a copy of the GNU General Public License
190f2a
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
190f2a
+
190f2a
+   Please email any bugs, comments, and/or additions to this file to:
190f2a
+   bug-gdb@prep.ai.mit.edu  */
190f2a
+
190f2a
+int
190f2a
+main (int argc, char **argv)
190f2a
+{
190f2a
+  static int i = 0; /* `static' to start initialized.  */
190f2a
+  int j = 2;
190f2a
+
190f2a
+  for (j = 0; j < 30; j++)
190f2a
+    i = 30 - j;
190f2a
+
190f2a
+  return 0;
190f2a
+}
190f2a
diff --git a/gdb/testsuite/gdb.base/watchpoint-cond.exp b/gdb/testsuite/gdb.base/watchpoint-cond.exp
190f2a
new file mode 100644
190f2a
--- /dev/null
190f2a
+++ b/gdb/testsuite/gdb.base/watchpoint-cond.exp
190f2a
@@ -0,0 +1,37 @@
190f2a
+# Copyright 2008 Free Software Foundation, Inc.
190f2a
+
190f2a
+# This program is free software; you can redistribute it and/or modify
190f2a
+# it under the terms of the GNU General Public License as published by
190f2a
+# the Free Software Foundation; either version 3 of the License, or
190f2a
+# (at your option) any later version.
190f2a
+#
190f2a
+# This program is distributed in the hope that it will be useful,
190f2a
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
190f2a
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
190f2a
+# GNU General Public License for more details.
190f2a
+#
190f2a
+# You should have received a copy of the GNU General Public License
190f2a
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
190f2a
+
190f2a
+set testfile watchpoint-cond
190f2a
+set srcfile ${testfile}.c
190f2a
+set binfile [standard_output_file ${testfile}]
190f2a
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
190f2a
+    untested "Couldn't compile test program"
190f2a
+    return -1
190f2a
+}
190f2a
+
190f2a
+# Get things started.
190f2a
+
190f2a
+gdb_exit
190f2a
+gdb_start
190f2a
+gdb_reinitialize_dir $srcdir/$subdir
190f2a
+gdb_load ${binfile}
190f2a
+
190f2a
+if { [runto_main] < 0 } {
190f2a
+    untested watchpoint-cond
190f2a
+    return -1
190f2a
+}
190f2a
+
190f2a
+gdb_test "watch i if i < 20" "atchpoint \[0-9\]+: i"
190f2a
+gdb_test "cont" "atchpoint \[0-9\]+: i.*Old value = 20.*New value = 19.*"