This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] fix source -v


Hi.

"source -v script" currently leaves -v stuck in the "on" position.
I've commited this patch to fix it.

2010-04-06  Doug Evans  <dje@google.com>

	* cli/cli-cmds.c (source_command): Run cleanups.

	testsuite/
	* gdb.base/source-test.gdb: New file.
	* gdb.base/source.exp: Test source -v.

Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.98
diff -u -p -r1.98 cli-cmds.c
--- cli/cli-cmds.c	5 Mar 2010 20:18:15 -0000	1.98
+++ cli/cli-cmds.c	7 Apr 2010 03:39:27 -0000
@@ -599,6 +599,8 @@ source_command (char *args, int from_tty
     }
 
   source_script (file, from_tty);
+
+  do_cleanups (old_cleanups);
 }
 
 
Index: testsuite/gdb.base/source-test.gdb
===================================================================
RCS file: testsuite/gdb.base/source-test.gdb
diff -N testsuite/gdb.base/source-test.gdb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.base/source-test.gdb	7 Apr 2010 03:39:27 -0000
@@ -0,0 +1,20 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2010 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/>.
+
+# Test GDB's "source" command options.
+
+echo test source options\n
Index: testsuite/gdb.base/source.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/source.exp,v
retrieving revision 1.9
diff -u -p -r1.9 source.exp
--- testsuite/gdb.base/source.exp	7 Jan 2010 20:07:18 -0000	1.9
+++ testsuite/gdb.base/source.exp	7 Apr 2010 03:39:27 -0000
@@ -34,5 +34,21 @@ gdb_start
 gdb_test "source ${srcdir}/${subdir}/source-error.gdb" \
     "source-error.gdb:21: Error in sourced command file:\[\r\n\]*Cannot access memory at address 0x0.*" \
     "script contains error"
-    
+
+gdb_test "source -v ${srcdir}/${subdir}/source-test.gdb" \
+    "echo test source options.*" \
+    "source -v"
+
+# There was a bug where -v got stuck in the "on" position.
+# Verify "source script", without the -v, is not verbose.
+set test "source after -v"
+gdb_test_multiple "source ${srcdir}/${subdir}/source-test.gdb" $test {
+    -re "echo test source options.*$gdb_prompt $" {
+	fail "$test"
+    }
+    -re "test source options.*$gdb_prompt $" {
+	pass "$test"
+    }
+}
+
 gdb_exit


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]