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