From 96e398662d34c0e443e76800974d81cfb3ead3f4 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Wed, 7 Apr 2010 03:42:55 +0000 Subject: [PATCH] * cli/cli-cmds.c (source_command): Run cleanups. testsuite/ * gdb.base/source-test.gdb: New file. * gdb.base/source.exp: Test source -v. --- gdb/ChangeLog | 4 ++++ gdb/cli/cli-cmds.c | 2 ++ gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/source-test.gdb | 20 ++++++++++++++++++++ gdb/testsuite/gdb.base/source.exp | 18 +++++++++++++++++- 5 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 gdb/testsuite/gdb.base/source-test.gdb diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2cc9f29..9ba91ff 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2010-04-06 Doug Evans + + * cli/cli-cmds.c (source_command): Run cleanups. + 2010-04-06 Stan Shebs * defs.h (char_ptr): Move typedef here from... diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index bc79258..ae0be7a 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -599,6 +599,8 @@ source_command (char *args, int from_tty) } source_script (file, from_tty); + + do_cleanups (old_cleanups); } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 743170e..d0d95ea 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-04-06 Doug Evans + + * gdb.base/source-test.gdb: New file. + * gdb.base/source.exp: Test source -v. + 2010-04-06 Ulrich Weigand * gdb.cp/inherit.exp (test_print_anon_union): Fix re_class pattern. diff --git a/gdb/testsuite/gdb.base/source-test.gdb b/gdb/testsuite/gdb.base/source-test.gdb new file mode 100644 index 0000000..76cf645 --- /dev/null +++ b/gdb/testsuite/gdb.base/source-test.gdb @@ -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 . + +# Test GDB's "source" command options. + +echo test source options\n diff --git a/gdb/testsuite/gdb.base/source.exp b/gdb/testsuite/gdb.base/source.exp index f7b8cff..3d5e72a 100644 --- a/gdb/testsuite/gdb.base/source.exp +++ b/gdb/testsuite/gdb.base/source.exp @@ -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" { + fail "$test" + } + -re "test source options" { + pass "$test" + } +} + gdb_exit -- 2.7.4