aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/commands.exp
diff options
context:
space:
mode:
authorAndrew Stubbs <andrew.stubbs@st.com>2006-04-07 13:31:15 +0000
committerAndrew Stubbs <andrew.stubbs@st.com>2006-04-07 13:31:15 +0000
commite28493f22671b9acb23366572cfba9dd5ed13a8d (patch)
tree5cf23b92d541855717b39dc9e1c8819371e31f13 /gdb/testsuite/gdb.base/commands.exp
parentf2e349f91a7063d6a09630bce740696a7bd38fea (diff)
downloadgdb-e28493f22671b9acb23366572cfba9dd5ed13a8d.zip
gdb-e28493f22671b9acb23366572cfba9dd5ed13a8d.tar.gz
gdb-e28493f22671b9acb23366572cfba9dd5ed13a8d.tar.bz2
2006-04-07 Andrew Stubbs <andrew.stubbs@st.com>
gdb/ * cli/cli-script.c (struct user_args): Add command field. (arg_cleanup): Free command string. (setup_user_args): Copy the command line before relying on it. gdb/testsuite/ * gdb.base/commands.exp (recursive_source_test): New test.
Diffstat (limited to 'gdb/testsuite/gdb.base/commands.exp')
-rw-r--r--gdb/testsuite/gdb.base/commands.exp36
1 files changed, 35 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index 893c98c..e981f81 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -583,7 +583,40 @@ proc stray_arg0_test { } {
"\\\$\[0-9\]* = 1" \
"stray_arg0_test #4"
}
-
+
+# Test that GDB can handle arguments when sourcing files recursively.
+# If the arguments are overwritten with ####### then the test has failed.
+proc recursive_source_test {} {
+ set fd [open "file1" w]
+ puts $fd \
+{source file2
+abcdef qwerty}
+ close $fd
+
+ set fd [open "file2" w]
+ puts $fd \
+{define abcdef
+ echo 1: <<<$arg0>>>\n
+ source file3
+ echo 2: <<<$arg0>>>\n
+end}
+ close $fd
+
+ set fd [open "file3" w]
+ puts $fd \
+"echo in file3\\n
+#################################################################"
+ close $fd
+
+ gdb_test "source file1" \
+ "1: <<<qwerty>>>\[\r\n]+in file3\[\r\n]+2: <<<qwerty>>>" \
+ "recursive source test"
+
+ file delete file1
+ file delete file2
+ file delete file3
+}
+
gdbvar_simple_if_test
gdbvar_simple_while_test
gdbvar_complex_if_while_test
@@ -600,3 +633,4 @@ deprecated_command_test
bp_deleted_in_command_test
temporary_breakpoint_commands
stray_arg0_test
+recursive_source_test