Index: gdb/testsuite/gdb.base/commands.exp |
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp |
index e26dac06074f62cb81419f2d3d44c5ba97958f24..8313dbf6719b2246b1a344db57f77f3e2e6f13e0 100644 |
--- a/gdb/testsuite/gdb.base/commands.exp |
+++ b/gdb/testsuite/gdb.base/commands.exp |
@@ -1,5 +1,4 @@ |
-# Copyright 1988, 1990-1992, 1994-1995, 1997-2003, 2005-2012 Free |
-# Software Foundation, Inc. |
+# Copyright 1988-2013 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 |
@@ -18,6 +17,8 @@ |
# test special commands (if, while, etc) |
# |
+standard_testfile |
+ |
if { [prepare_for_testing commands.exp commands run.c {debug additional_flags=-DFAKEARGV}] } { |
return -1 |
} |
@@ -75,7 +76,7 @@ proc progvar_simple_if_test {} { |
gdb_test "if value == 5\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \ |
"\\\$\[0-9\]* = 0xfeedface" \ |
"progvar_simple_if_test #2" |
- gdb_stop_suppressing_tests; |
+ gdb_stop_suppressing_tests |
} |
proc progvar_simple_while_test {} { |
@@ -95,7 +96,7 @@ proc progvar_simple_while_test {} { |
gdb_test "while value > 0\np/x 0xfeedface\nset value -= 1\nend" \ |
"\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \ |
"progvar_simple_while_test #1" |
- gdb_stop_suppressing_tests; |
+ gdb_stop_suppressing_tests |
} |
proc progvar_complex_if_while_test {} { |
@@ -116,7 +117,7 @@ proc progvar_complex_if_while_test {} { |
gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" \ |
"\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \ |
"progvar_complex_if_while_test #1" |
- gdb_stop_suppressing_tests; |
+ gdb_stop_suppressing_tests |
} |
proc if_while_breakpoint_command_test {} { |
@@ -151,7 +152,7 @@ proc if_while_breakpoint_command_test {} { |
gdb_test "info break" \ |
"while.*set.*if.*p/x.*else.*p/x.*end.*" \ |
"info break in if_while_breakpoint_command_test" |
- gdb_stop_suppressing_tests; |
+ gdb_stop_suppressing_tests |
} |
# Test that we can run the inferior from breakpoint commands. |
@@ -192,7 +193,7 @@ proc infrun_breakpoint_command_test {} { |
"Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[ \]*if \\(value > 1\\) \{.*\[0-9\]*\[ \]*value \\*= factorial \\(value - 1\\);.*" \ |
"continue in infrun_breakpoint_command_test" |
- gdb_stop_suppressing_tests; |
+ gdb_stop_suppressing_tests |
} |
proc breakpoint_command_test {} { |
@@ -214,7 +215,7 @@ proc breakpoint_command_test {} { |
"Breakpoint \[0-9\]*, factorial.*Now the value is 5" \ |
"continue in breakpoint_command_test" |
gdb_test "print value" " = 5" "print value in breakpoint_command_test" |
- gdb_stop_suppressing_tests; |
+ gdb_stop_suppressing_tests |
} |
# Test a simple user defined command (with arguments) |
@@ -307,6 +308,8 @@ proc watchpoint_command_test {} { |
"end commands on watch" |
set test "continue with watch" |
+ set lno_1 [gdb_get_line_number "commands.exp: hw local_var out of scope" "run.c"] |
+ set lno_2 [gdb_get_line_number "commands.exp: local_var out of scope" "run.c"] |
gdb_test_multiple "continue" "$test" { |
-re "No symbol \"value\" in current context.\r\n$gdb_prompt $" { |
# Happens if GDB actually runs the watchpoints commands, |
@@ -314,7 +317,7 @@ proc watchpoint_command_test {} { |
# scope. |
fail $test |
} |
- -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:(53|77).*$gdb_prompt $" { |
+ -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:($lno_1|$lno_2).*$gdb_prompt $" { |
pass $test |
} |
} |
@@ -380,7 +383,7 @@ proc test_command_prompt_position {} { |
timeout { fail "(timeout) 3 commands in test_command_prompt_position" } |
} |
- gdb_stop_suppressing_tests; |
+ gdb_stop_suppressing_tests |
} |
@@ -556,7 +559,9 @@ proc stray_arg0_test { } { |
# Test that GDB is able to source a file with an indented comment. |
proc source_file_with_indented_comment {} { |
- set fd [open "file1" w] |
+ set file1 [standard_output_file file1] |
+ |
+ set fd [open "$file1" w] |
puts $fd \ |
{define my_fun |
#indented comment |
@@ -564,40 +569,44 @@ end |
echo Done!\n} |
close $fd |
- gdb_test "source file1" "Done!" "source file with indented comment" |
+ gdb_test "source $file1" "Done!" "source file with indented comment" |
} |
# 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] |
+ set file1 [standard_output_file file1] |
+ set file2 [standard_output_file file2] |
+ set file3 [standard_output_file file3] |
+ |
+ set fd [open "$file1" w] |
puts $fd \ |
-{source file2 |
-abcdef qwerty} |
+"source $file2 |
+abcdef qwerty" |
close $fd |
- set fd [open "file2" w] |
+ set fd [open "$file2" w] |
puts $fd \ |
-{define abcdef |
- echo 1: <<<$arg0>>>\n |
- source file3 |
- echo 2: <<<$arg0>>>\n |
-end} |
+"define abcdef |
+ echo 1: <<<\$arg0>>>\\n |
+ source $file3 |
+ echo 2: <<<\$arg0>>>\\n |
+end" |
close $fd |
- set fd [open "file3" w] |
+ set fd [open "$file3" w] |
puts $fd \ |
"echo in file3\\n |
#################################################################" |
close $fd |
- gdb_test "source file1" \ |
+ 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 |
+ file delete $file1 |
+ file delete $file2 |
+ file delete $file3 |
} |
proc gdb_test_no_prompt { command result msg } { |