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