From cce0ae568c7e30e0a7b8d1bd77f8c4b7d7b8ce7b Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 18 May 2022 13:22:02 +0100 Subject: [PATCH] gdb: Fix DUPLICATE and PATH regressions throughout The previous patch to add -prompt/-lbl to gdb_test introduced a regression: Before, you could specify an explicit empty message to indicate you didn't want to PASS, like so: gdb_test COMMAND PATTERN "" After said patch, gdb_test no longer distinguishes no-message-specified vs empty-message, so tests that previously would be silent on PASS, now started emitting PASS messages based on COMMAND. This in turn introduced a number of PATH/DUPLICATE violations in the testsuite. This commit fixes all the regressions I could see. This patch uses the new -nopass feature introduced in the previous commit, but tries to avoid it if possible. Most of the patch fixes DUPLICATE issues the usual way, of using with_test_prefix or explicit unique messages. See previous commit's log for more info. In addition to looking for DUPLICATEs, I also looked for cases where we would now end up with an empty message in gdb.sum, due to a gdb_test being passed both no message and empty command. E.g., this in gdb.ada/bp_reset.exp: gdb_run_cmd gdb_test "" "Breakpoint $decimal, foo\\.nested_sub \\(\\).*" was resulting in this in gdb.sum: PASS: gdb.ada/bp_reset.exp: I fixed such cases by passing an explicit message. We may want to make such cases error out. Tested on x86_64 GNU/Linux, native and native-extended-gdbserver. I see zero PATH cases now. I get zero DUPLICATEs with native testing now. I still see some DUPLICATEs with native-extended-gdbserver, but those were preexisting, unrelated to the gdb_test change. Change-Id: I5375f23f073493e0672190a0ec2e847938a580b2 --- gdb/testsuite/gdb.ada/bp_reset.exp | 3 +- gdb/testsuite/gdb.ada/exec_changed.exp | 19 +- gdb/testsuite/gdb.ada/expr_delims.exp | 3 +- .../gdb.ada/out_of_line_in_inlined.exp | 3 +- gdb/testsuite/gdb.base/break-probes.exp | 3 +- gdb/testsuite/gdb.base/break.exp | 218 +++--- gdb/testsuite/gdb.base/checkpoint.exp | 35 +- gdb/testsuite/gdb.base/gdb-sigterm.exp | 27 +- gdb/testsuite/gdb.base/info-macros.exp | 14 +- gdb/testsuite/gdb.base/pie-execl.exp | 4 +- gdb/testsuite/gdb.base/setvar.exp | 12 +- gdb/testsuite/gdb.base/sizeof.exp | 12 +- gdb/testsuite/gdb.base/style.exp | 37 +- .../gdb.base/watchpoint-unaligned.exp | 10 +- gdb/testsuite/gdb.base/watchpoint.exp | 6 +- gdb/testsuite/gdb.cp/cpexprs.exp.tcl | 3 +- gdb/testsuite/gdb.cp/static-method.exp | 3 +- gdb/testsuite/gdb.reverse/insn-reverse.exp | 4 +- .../gdb.reverse/machinestate-precsave.exp | 271 +++---- gdb/testsuite/gdb.reverse/machinestate.exp | 268 +++---- .../access-mem-running-thread-exit.exp | 9 +- .../gdb.threads/attach-into-signal.exp | 2 +- gdb/testsuite/gdb.threads/sigstep-threads.exp | 6 +- gdb/testsuite/gdb.trace/actions.exp | 2 +- gdb/testsuite/gdb.trace/backtrace.exp | 34 +- gdb/testsuite/gdb.trace/collection.exp | 722 +++++++++--------- gdb/testsuite/gdb.trace/infotrace.exp | 2 +- gdb/testsuite/gdb.trace/passc-dyn.exp | 52 +- gdb/testsuite/gdb.trace/report.exp | 2 - gdb/testsuite/gdb.trace/tfind.exp | 8 +- gdb/testsuite/gdb.trace/tspeed.exp | 10 +- gdb/testsuite/gdb.trace/while-dyn.exp | 61 +- gdb/testsuite/gdb.trace/while-stepping.exp | 2 +- gdb/testsuite/lib/completion-support.exp | 4 +- gdb/testsuite/lib/gdb-guile.exp | 16 +- gdb/testsuite/lib/gdb.exp | 8 +- gdb/testsuite/lib/range-stepping-support.exp | 4 +- gdb/testsuite/lib/trace-support.exp | 4 +- 38 files changed, 969 insertions(+), 934 deletions(-) diff --git a/gdb/testsuite/gdb.ada/bp_reset.exp b/gdb/testsuite/gdb.ada/bp_reset.exp index 12a4aa2c6dd..f1e8b2e9473 100644 --- a/gdb/testsuite/gdb.ada/bp_reset.exp +++ b/gdb/testsuite/gdb.ada/bp_reset.exp @@ -35,5 +35,4 @@ gdb_test "break do_nothing" \ # the first breakpoint inside nested_sub. gdb_run_cmd -gdb_test "" "Breakpoint $decimal, foo\\.nested_sub \\(\\).*" - +gdb_test "" "Breakpoint $decimal, foo\\.nested_sub \\(\\).*" "run to first breakpoint" diff --git a/gdb/testsuite/gdb.ada/exec_changed.exp b/gdb/testsuite/gdb.ada/exec_changed.exp index 013d8ca9007..52868f61c89 100644 --- a/gdb/testsuite/gdb.ada/exec_changed.exp +++ b/gdb/testsuite/gdb.ada/exec_changed.exp @@ -48,7 +48,8 @@ gdb_reinitialize_dir $srcdir/$subdir # Load the first executable. -gdb_test "shell mv ${binfile} ${common_binfile}" ".*" "" +gdb_test "shell mv ${binfile} ${common_binfile}" "" \ + "shell mv \${binfile} \${common_binfile}" gdb_load ${common_binfile} # Start the program, we should land in the program main procedure @@ -65,10 +66,13 @@ gdb_test "" \ # second executable into its place. Ensure that the new # executable is at least a second newer than the old. -gdb_test "shell mv ${common_binfile} ${binfile}" ".*" "" -gdb_test "shell mv ${binfile2} ${common_binfile}" ".*" "" -gdb_test "shell sleep 1" ".*" "" -gdb_test "shell touch ${common_binfile}" ".*" "" +gdb_test "shell mv ${common_binfile} ${binfile}" "" \ + "shell mv \${common_binfile} \${binfile}" +gdb_test "shell mv ${binfile2} ${common_binfile}" "" \ + "shell mv \${binfile2} \${common_binfile}" +gdb_test "shell sleep 1" "" "shell sleep 1, once" +gdb_test "shell touch ${common_binfile}" "" \ + "shell touch \${common_binfile}" # Start the program a second time, GDB should land in procedure Second # this time. @@ -92,8 +96,9 @@ gdb_test_no_output "mt set symbol-cache-size 0" # starting after having re-read symbols. PR 17855. gdb_breakpoint break_me -gdb_test "shell touch ${binfile}$EXEEXT" ".*" "" -gdb_test "shell sleep 1" ".*" "" +gdb_test "shell touch ${binfile}$EXEEXT" "" \ + "shell touch \${binfile}\$EXEEXT" +gdb_test "shell sleep 1" "" "shell sleep 1, twice" if { [gdb_start_cmd] < 0 } { # PR 17855: At this point gdb may have crashed or gotten an internal diff --git a/gdb/testsuite/gdb.ada/expr_delims.exp b/gdb/testsuite/gdb.ada/expr_delims.exp index f77d08a67cf..c53d88fab34 100644 --- a/gdb/testsuite/gdb.ada/expr_delims.exp +++ b/gdb/testsuite/gdb.ada/expr_delims.exp @@ -33,7 +33,8 @@ gdb_test "break foo.adb:$bp_location" \ "Breakpoint $decimal.*" \ gdb_run_cmd -gdb_test "" "Breakpoint $decimal, foo \\(\\).*" +gdb_test "" "Breakpoint $decimal, foo \\(\\).*" \ + "run to foo" gdb_test "continue" \ "Continuing\\..*Breakpoint $decimal, foo \\(\\).*" diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp index b1f8f877156..db1b3b32aa5 100644 --- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp +++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp @@ -34,7 +34,8 @@ foreach_with_prefix scenario {all minimal} { gdb_run_cmd gdb_test "" \ - "Breakpoint $decimal, foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" + "Breakpoint $decimal, foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \ + "run to foo_o224_021.child1.child2" set opt_addr_in "($hex in)?" gdb_test "bt" \ diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.base/break-probes.exp index d69281c8003..51687c5ca68 100644 --- a/gdb/testsuite/gdb.base/break-probes.exp +++ b/gdb/testsuite/gdb.base/break-probes.exp @@ -38,7 +38,8 @@ gdb_test_no_output "set stop-on-solib-events 1" # Start the inferior and run to the first stop gdb_run_cmd -gdb_test "" ".*Stopped due to shared library event.*" +gdb_test "" ".*Stopped due to shared library event.*" \ + "run to shared library event" # Check if we're using probes. set using_probes 0 diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 2c939ada14a..4421459154f 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -231,122 +231,128 @@ gdb_test_multiple "info break 3-5" "info break 3-5" { # Test with value history -gdb_test "print 1" "" "" -gdb_test "print 2" "" "" -gdb_test "print 3" "" "" -gdb_test "print 4" "" "" -gdb_test "print 5" "" "" -gdb_test "print 6" "" "" - -# $2 is 2 and $$ is 5 -gdb_test_no_output "disable \$2 \$\$" "disable using history values" - -set see1 0 -set see2 0 -set see3 0 -set see4 0 -set see5 0 -set see6 0 - -gdb_test_multiple "info break" "check disable with history values" { - -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" { - set see1 1 - exp_continue - } - -re "2\[\t \]+breakpoint *keep n\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { - set see2 1 - exp_continue - } - -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location7\[^\r\n\]*" { - set see3 1 - exp_continue - } - -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { - set see4 1 - exp_continue - } - -re "5\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location1\[^\r\n\]*" { - set see5 1 - exp_continue - } - -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location2\[^\r\n\]*" { - set see6 1 - exp_continue - } - -re ".*$gdb_prompt $" { - if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then { - pass "check disable with history values" - } else { - fail "check disable with history values" +with_test_prefix "with value history" { + gdb_test "print 1" + gdb_test "print 2" + gdb_test "print 3" + gdb_test "print 4" + gdb_test "print 5" + gdb_test "print 6" + + # $2 is 2 and $$ is 5 + gdb_test_no_output "disable \$2 \$\$" "disable using history values" + + set see1 0 + set see2 0 + set see3 0 + set see4 0 + set see5 0 + set see6 0 + + gdb_test_multiple "info break" "check disable with history values" { + -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" { + set see1 1 + exp_continue + } + -re "2\[\t \]+breakpoint *keep n\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { + set see2 1 + exp_continue + } + -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location7\[^\r\n\]*" { + set see3 1 + exp_continue + } + -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { + set see4 1 + exp_continue + } + -re "5\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location1\[^\r\n\]*" { + set see5 1 + exp_continue + } + -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location2\[^\r\n\]*" { + set see6 1 + exp_continue + } + -re ".*$gdb_prompt $" { + if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then { + pass "check disable with history values" + } else { + fail "check disable with history values" + } } } } -gdb_test "enable" "" "" -gdb_test "set \$foo = 3" "" "" -gdb_test "set \$bar = 6" "" "" -gdb_test_no_output "disable \$foo \$bar" "disable with convenience values" - -set see1 0 -set see2 0 -set see3 0 -set see4 0 -set see5 0 -set see6 0 - -gdb_test_multiple "info break" "check disable with convenience values" { - -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" { - set see1 1 - exp_continue - } - -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { - set see2 1 - exp_continue - } - -re "3\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location7\[^\r\n\]*" { - set see3 1 - exp_continue - } - -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { - set see4 1 - exp_continue - } - -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { - set see5 1 - exp_continue - } - -re "6\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location2\[^\r\n\]*" { - set see6 1 - exp_continue - } - -re ".*$gdb_prompt $" { - if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then { - pass "check disable with convenience values" - } else { - fail "check disable with convenience values" +with_test_prefix "with convenience vars" { + gdb_test "enable" + gdb_test "set \$foo = 3" + gdb_test "set \$bar = 6" + gdb_test_no_output "disable \$foo \$bar" "disable with convenience values" + + set see1 0 + set see2 0 + set see3 0 + set see4 0 + set see5 0 + set see6 0 + + gdb_test_multiple "info break" "check disable with convenience values" { + -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" { + set see1 1 + exp_continue + } + -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { + set see2 1 + exp_continue + } + -re "3\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location7\[^\r\n\]*" { + set see3 1 + exp_continue + } + -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { + set see4 1 + exp_continue + } + -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { + set see5 1 + exp_continue + } + -re "6\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location2\[^\r\n\]*" { + set see6 1 + exp_continue + } + -re ".*$gdb_prompt $" { + if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then { + pass "check disable with convenience values" + } else { + fail "check disable with convenience values" + } } } } # test with bad values -gdb_test "enable" "" "" -gdb_test "disable 10" "No breakpoint number 10." \ - "disable non-existent breakpoint 10" - -gdb_test_no_output "set \$baz = 1.234" -gdb_test "disable \$baz" \ - "Convenience variable must have integer value.*" \ - "disable with non-integer convenience var" -gdb_test "disable \$grbx" \ - "Convenience variable must have integer value.*" \ - "disable with non-existent convenience var" -gdb_test "disable \$10" \ - "History has not yet reached .10." \ - "disable with non-existent history value" -gdb_test "disable \$1foo" \ - "Convenience variable must have integer value.*" \ - "disable with badly formed history value" +with_test_prefix "bad values" { + gdb_test "enable" + gdb_test "disable 10" "No breakpoint number 10." \ + "disable non-existent breakpoint 10" + + gdb_test_no_output "set \$baz = 1.234" + gdb_test "disable \$baz" \ + "Convenience variable must have integer value.*" \ + "disable with non-integer convenience var" + gdb_test "disable \$grbx" \ + "Convenience variable must have integer value.*" \ + "disable with non-existent convenience var" + gdb_test "disable \$10" \ + "History has not yet reached .10." \ + "disable with non-existent history value" + gdb_test "disable \$1foo" \ + "Convenience variable must have integer value.*" \ + "disable with badly formed history value" +} # FIXME: The rest of this test doesn't work with anything that can't # handle arguments. diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp index edb1c422c0e..e81e4f44e48 100644 --- a/gdb/testsuite/gdb.base/checkpoint.exp +++ b/gdb/testsuite/gdb.base/checkpoint.exp @@ -57,35 +57,34 @@ set break4_loc [gdb_get_line_number "breakpoint 4"] gdb_breakpoint $break1_loc gdb_test "continue" "breakpoint 1.*" "break1 start" +gdb_test "checkpoint" "" "checkpoint one" -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 two" +gdb_test "checkpoint" "" "checkpoint two" -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 three" +gdb_test "checkpoint" "" "checkpoint three" -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 four" +gdb_test "checkpoint" "" "checkpoint four" -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 five" +gdb_test "checkpoint" "" "checkpoint five" -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 six" +gdb_test "checkpoint" "" "checkpoint six" -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 seven" +gdb_test "checkpoint" "" "checkpoint seven" -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 eight" +gdb_test "checkpoint" "" "checkpoint eight" -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 nine" +gdb_test "checkpoint" "" "checkpoint nine" -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 ten" - -gdb_test "checkpoint" ".*" "" +gdb_test "checkpoint" "" "checkpoint ten" gdb_test "info checkpoints" \ " 1 .* 2 .* 3 .* 4 .* 5 .* 6 .* 7 .* 8 .* 9 .* 10 .*" \ @@ -165,43 +164,43 @@ gdb_test "shell diff -s $pi_txt $copy1_txt" \ gdb_breakpoint $break1_loc gdb_test "restart 1" "Switching to .*c == EOF.*" "restart 1 two" -gdb_test "continue" ".*" "" +gdb_test "continue" "" "continue, 1" gdb_test "continue 100" "breakpoint 1.*" "breakpoint 1 1 one" gdb_test "step" "if .c == EOF.*" "step in 1 two" gdb_test "print lines" " = 102.*" "verify lines 1 two" gdb_test "restart 2" "Switching to .*c == EOF.*" "restart 2 two" -gdb_test "continue" ".*" "" +gdb_test "continue" "" "continue, 2" gdb_test "continue 100" "breakpoint 1.*" "breakpoint 1 2 one" gdb_test "step" "if .c == EOF.*" "step in 2 two" gdb_test "print lines" " = 112.*" "verify lines 2 two" gdb_test "restart 3" "Switching to .*c == EOF.*" "restart 3 two" -gdb_test "continue" ".*" "" +gdb_test "continue" "" "continue, 3" gdb_test "continue 500" "breakpoint 1.*" "breakpoint 1 3 one" gdb_test "step" "if .c == EOF.*" "step in 3 two" gdb_test "print lines" " = 522.*" "verify lines 3 two" gdb_test "restart 4" "Switching to .*c == EOF.*" "restart 4 two" -gdb_test "continue" ".*" "" +gdb_test "continue" "" "continue, 4" gdb_test "continue 500" "breakpoint 1.*" "breakpoint 1 4 one" gdb_test "step" "if .c == EOF.*" "step in 4 two" gdb_test "print lines" " = 532.*" "verify lines 4 two" gdb_test "restart 5" "Switching to .*c == EOF.*" "restart 5 two" -gdb_test "continue" ".*" "" +gdb_test "continue" "" "continue, 5" gdb_test "continue 1000" "breakpoint 1.*" "breakpoint 1 5 one" gdb_test "step" "if .c == EOF.*" "step in 5 two" gdb_test "print lines" " = 1042.*" "verify lines 5 two" gdb_test "restart 6" "Switching to .*c == EOF.*" "restart 6 two" -gdb_test "continue" ".*" "" +gdb_test "continue" "" "continue, 6" gdb_test "continue 1000" "breakpoint 1.*" "breakpoint 1 6 one" gdb_test "step" "if .c == EOF.*" "step in 6 two" gdb_test "print lines" " = 1052.*" "verify lines 6 two" gdb_test "restart 7" "Switching to .*c == EOF.*" "restart 7 two" -gdb_test "continue" ".*" "" +gdb_test "continue" "" "continue, 7" gdb_test "continue 1100" "breakpoint 1.*" "breakpoint 1 7 one" gdb_test "step" "if .c == EOF.*" "step in 7 two" gdb_test "print lines" " = 1162.*" "verify lines 7 two" diff --git a/gdb/testsuite/gdb.base/gdb-sigterm.exp b/gdb/testsuite/gdb.base/gdb-sigterm.exp index 6abf2b8a236..dd3bb731ab2 100644 --- a/gdb/testsuite/gdb.base/gdb-sigterm.exp +++ b/gdb/testsuite/gdb.base/gdb-sigterm.exp @@ -44,18 +44,15 @@ proc do_test { pass } { gdb_breakpoint "${testfile}.c:[gdb_get_line_number "loop-line" ${testfile}.c]" \ temporary - # gdb_continue_to_breakpoint would print a pass message. - gdb_test "continue" "Temporary breakpoint .* loop-line .*" "" + gdb_test "continue" "Temporary breakpoint .* loop-line .*" - gdb_test_no_output "set range-stepping off" "" - gdb_test_no_output "set debug infrun 1" "" + gdb_test_no_output "set range-stepping off" + gdb_test_no_output "set debug infrun 1" - set test "run a bit #$pass" set abort 1 - gdb_test_multiple "step" $test { + gdb_test_multiple "step" "run a bit" { -re {\[infrun\] process_event_stop_test: stepping inside range} { - # Suppress pass $test - verbose -log "$pf_prefix $test: ran" + pass $gdb_test_name set abort 0 } } @@ -67,15 +64,15 @@ proc do_test { pass } { set gdb_pid [exp_pid -i [board_info host fileid]] remote_exec host "kill -TERM ${gdb_pid}" - set test "expect eof #$pass" + set test "expect eof" set abort 1 set stepping 0 # If GDB mishandles the SIGTERM and doesn't exit, this should FAIL # with timeout. We don't expect a GDB prompt, so we see one, # we'll FAIL too. - gdb_test_multiple "" $test { + gdb_test_multiple "" "expect eof" { eof { - verbose -log "$pf_prefix $test: got eof" + pass "$gdb_test_name (got eof)" set abort 0 } -re {\[infrun\] process_event_stop_test: stepping inside range} { @@ -92,9 +89,11 @@ proc do_test { pass } { set passes 50 for {set pass 0} {$pass < $passes} {incr pass} { - clean_restart ${testfile} - if { [do_test $pass] != 0 } { - break + with_test_prefix "pass=$pass" { + clean_restart ${testfile} + if { [do_test $pass] != 0 } { + break + } } } diff --git a/gdb/testsuite/gdb.base/info-macros.exp b/gdb/testsuite/gdb.base/info-macros.exp index 39c9bc696cc..b2d75e49f46 100644 --- a/gdb/testsuite/gdb.base/info-macros.exp +++ b/gdb/testsuite/gdb.base/info-macros.exp @@ -113,7 +113,7 @@ gdb_test_lines $test $testname $r1.*$r2 \ -re-not "#define THREE" \ -re-not "#define FOUR" -gdb_test "next" ".*" "" +gdb_test "next" "" "next, 1" set r1 "#define FOO \" \"" set r2 "#define ONE" @@ -123,9 +123,9 @@ gdb_test_lines $test $testname $r1.*$r2.*$r3 \ -re-not "#define THREE" \ -re-not "#define FOUR" -gdb_test "next" ".*" "" +gdb_test "next" "" "next, 2" -# in alpabetical order... +# in alphabetical order... set r1 "#define FOO \"world\"" set r2 "#define ONE" set r3 "#define THREE" @@ -138,7 +138,7 @@ gdb_test_lines $test $testname $r1.*$r2.*$r3.*$r4 \ set test "info macros *\$pc" gdb_test_lines $test "" $r1.*$r2.*$r3.*$r4 \ -re-not "#define FOUR" -gdb_test "next" ".*" "" +gdb_test "next" "" "next, 3" set r1 "#define FOO \" \"" set r2 "#define ONE" @@ -148,8 +148,8 @@ set testname "$test 5" gdb_test_lines $test $testname $r1.*$r2.*$r3 \ -re-not "#define THREE" \ -re-not "#define FOUR" -gdb_test "next" ".*" "" -gdb_test "next" ".*" "" +gdb_test "next" "" "next, 4" +gdb_test "next" "" "next, 5" set r1 "#define DEF_MACROS" set testname "$test 6" @@ -160,7 +160,7 @@ gdb_test_lines $test $testname $r1 \ -re-not "#define THREE" \ -re-not "#define FOUR" -gdb_test "next" ".*" "" +gdb_test "next" "" "next, 6" set r1 "#define DEF_MACROS" set r2 "#define FOO\\(a\\) foo = a" set r3 "#define FOUR" diff --git a/gdb/testsuite/gdb.base/pie-execl.exp b/gdb/testsuite/gdb.base/pie-execl.exp index 2364c74de96..f5dce989e28 100644 --- a/gdb/testsuite/gdb.base/pie-execl.exp +++ b/gdb/testsuite/gdb.base/pie-execl.exp @@ -59,7 +59,7 @@ if ![runto_main] { delete_breakpoints gdb_breakpoint "pie_execl_marker" -gdb_test "info breakpoints" ".*" "" +gdb_test "info breakpoints" "" "info breakpoints first" set addr1 "" set test "pie_execl_marker address first" @@ -101,7 +101,7 @@ gdb_test_multiple $test $test { } } -gdb_test "info breakpoints" ".*" "" +gdb_test "info breakpoints" "" "info breakpoints second" set addr2 "" set test "pie_execl_marker address second" diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp index a2997be0cb8..576df2a066c 100644 --- a/gdb/testsuite/gdb.base/setvar.exp +++ b/gdb/testsuite/gdb.base/setvar.exp @@ -74,20 +74,18 @@ proc test_set { args } { set arg [lindex $args $x] if { ($x == $final) || ([string first ".*" [lindex $args [expr $x + 1]]] >= 0) } { set match [lindex $args [expr $x + 1]] - if { $count == 1 } { - set mess "$message" - } else { - set mess "$message (#$count)" + set mess "$message -- $match" + if { $count != 1 } { + append mess " (#$count)" } incr count incr x } else { - set mess "" set match "" + set mess "$message -- $match" } verbose "doing $arg $match" - if [gdb_test "$arg" "$match" "$mess"] { - fail "$message -- $match" + if [gdb_test -nopass "$arg" "$match" "$mess"] { return 1 } } diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp index effd398ef05..7e86b2ac3e8 100644 --- a/gdb/testsuite/gdb.base/sizeof.exp +++ b/gdb/testsuite/gdb.base/sizeof.exp @@ -62,8 +62,10 @@ set sizeof_long_double [get_sizeof "long double" 8] # proc check_sizeof { type size } { - gdb_test "next" "" "" - gdb_test "p size" " = ${size}" "check sizeof \"$type\"" + with_test_prefix "check sizeof \"$type\"" { + gdb_test "next" + gdb_test "p size" " = ${size}" "size matches" + } } check_sizeof "char" ${sizeof_char} @@ -80,8 +82,10 @@ check_sizeof "double" ${sizeof_double} check_sizeof "long double" ${sizeof_long_double} proc check_valueof { exp val } { - gdb_test "next" "" "" - gdb_test "p /d value" " = ${val}" "check valueof \"$exp\"" + with_test_prefix "check valueof \"$exp\"" { + gdb_test "next" + gdb_test "p /d value" " = ${val}" "value matches" + } } # Check that GDB and the target agree over the sign of a character. diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index 2064e8d3894..2242c5bf743 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -44,16 +44,18 @@ proc limited_style { str style } { # A wrapper around 'clean_restart' from gdb.exp, this performs the # normal clean_restart, but then disables the currently disabled # style. -proc clean_restart_and_disable { args } { +proc clean_restart_and_disable { prefix args } { global currently_disabled_style - eval "clean_restart $args" + with_test_prefix "$prefix" { + eval "clean_restart $args" - if { $currently_disabled_style != "" } { - set st $currently_disabled_style - gdb_test_no_output "set style $st background none" "" - gdb_test_no_output "set style $st foreground none" "" - gdb_test_no_output "set style $st intensity normal" "" + if { $currently_disabled_style != "" } { + set st $currently_disabled_style + gdb_test_no_output "set style $st background none" + gdb_test_no_output "set style $st foreground none" + gdb_test_no_output "set style $st intensity normal" + } } } @@ -73,7 +75,7 @@ proc run_style_tests { } { # Restart GDB with the correct TERM variable setting, this # means that GDB will enable styling. - clean_restart_and_disable ${binfile} + clean_restart_and_disable "restart 1" ${binfile} set readnow [readnow] @@ -158,16 +160,15 @@ proc run_style_tests { } { set re_styled $re2_styled } - gdb_test_no_output "set width $width" - gdb_test "frame" $re_styled "frame when width=$width" - - # Reset width back to 0. Doing this in the loop rather than - # after, avoids trying to do "set width 30" while width is 20, - # which causes horizontal scrolling in the case that the fallback - # stub-termcap.c is used: + # Override width for the duration of the command, letting + # GDB reset back to 0. Doing this in the loop rather than + # after, avoids trying to do "set width 30" while width is + # 20, which causes horizontal scrolling in the case that + # the fallback stub-termcap.c is used: # ^M= 0} {incr i -1} { - gdb_test "reverse-stepi" "" "" + gdb_test -nopass "reverse-stepi" set post_regs($i) [capture_command_output "info all-registers" ""] } diff --git a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp b/gdb/testsuite/gdb.reverse/machinestate-precsave.exp index 348bec05e9a..bafea4a30f6 100644 --- a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp +++ b/gdb/testsuite/gdb.reverse/machinestate-precsave.exp @@ -82,7 +82,8 @@ gdb_test "record restore $precsave" \ # Proceed to end of main gdb_test "break $endmain" \ - "Breakpoint.* file .*$srcfile, line $endmain.*" "" + "Breakpoint.* file .*$srcfile, line $endmain.*" \ + "break at end of main" gdb_test_multiple "continue" "go to end of main forward" { -re ".*Breakpoint $decimal,.*$srcfile:$endmain.*$gdb_prompt $" { @@ -101,157 +102,167 @@ gdb_test_multiple "continue" "go to end of main forward" { # # Module global variable, reverse - -set breakloc [gdb_get_line_number \ - "module_global_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc" - -gdb_test "print aglobal" ".* = 0$newline" "module global reverse-breakpoint" -gdb_test "step" ".* module global post-change .*" "" -gdb_test "print aglobal" ".* = 1$newline" "module global forward past bp" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print aglobal" ".* = 0$newline" "module global reverse-step to bp" - +with_test_prefix "module global variable, reverse" { + set breakloc [gdb_get_line_number \ + "module_global_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" + + gdb_test "print aglobal" " = 0$newline" "module global reverse-breakpoint" + gdb_test "step" " module global post-change .*" + gdb_test "print aglobal" " = 1$newline" "module global forward past bp" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print aglobal" " = 0$newline" "module global reverse-step to bp" +} # Module static variable, reverse - -set breakloc [gdb_get_line_number \ - "module_static_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc" - -gdb_test "print astatic" ".* = 0$newline" "module static reverse-breakpoint" -gdb_test "step" ".* module static post-change .*" "" -gdb_test "print astatic" ".* = 1$newline" "module static forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print astatic" ".* = 0$newline" "module static reverse-step" +with_test_prefix "module static variable, reverse" { + set breakloc [gdb_get_line_number \ + "module_static_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" + + gdb_test "print astatic" " = 0$newline" "module static reverse-breakpoint" + gdb_test "step" " module static post-change .*" + gdb_test "print astatic" " = 1$newline" "module static forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print astatic" " = 0$newline" "module static reverse-step" +} # Function static variable, reverse - -set breakloc [gdb_get_line_number \ - "function_static_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc" - -gdb_test "print a" ".* = 0$newline" "function static reverse-breakpoint" -gdb_test "step" ".* function static post-change .*" "" -gdb_test "print a" ".* = 1$newline" "function static forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "function static reverse-step" +with_test_prefix "function static variable, reverse" { + set breakloc [gdb_get_line_number \ + "function_static_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" + + gdb_test "print a" " = 0$newline" "function static reverse-breakpoint" + gdb_test "step" " function static post-change .*" + gdb_test "print a" " = 1$newline" "function static forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " = 0$newline" "function static reverse-step" +} # Auto variable, reverse - -set breakloc [gdb_get_line_number \ - "auto_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc" - -gdb_test "print a" ".* = 0$newline" "auto var reverse-breakpoint" -gdb_test "step" ".* auto post-change .*" "" -gdb_test "print a" ".* = 1$newline" "auto var forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "auto var reverse-step" +with_test_prefix "auto variable, reverse" { + set breakloc [gdb_get_line_number \ + "auto_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" + + gdb_test "print a" " = 0$newline" "auto var reverse-breakpoint" + gdb_test "step" " auto post-change .*" + gdb_test "print a" " = 1$newline" "auto var forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " = 0$newline" "auto var reverse-step" +} # Register variable, reverse - -set breakloc [gdb_get_line_number \ - "register_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc" - -gdb_test "print a" ".* = 0$newline" "register var reverse-breakpoint" -gdb_test "step" ".* register post-change .*" "" -gdb_test "print a" ".* = 1$newline" \ - "register var step post-change, first time" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "register var reverse step-to" +with_test_prefix "register variable, reverse" { + set breakloc [gdb_get_line_number \ + "register_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" + + gdb_test "print a" " = 0$newline" "register var reverse-breakpoint" + gdb_test "step" " register post-change .*" + gdb_test "print a" " = 1$newline" \ + "register var step post-change, first time" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " = 0$newline" "register var reverse step-to" +} # Proceed to beginning of main -gdb_test "tbreak $beginmain" ".*$srcfile, line $beginmain.*" "" +gdb_test "tbreak $beginmain" ".*$srcfile, line $beginmain.*" \ + "tbreak at beginning of main" gdb_test "reverse-continue" ".*$srcfile:$beginmain.*" "reverse to main" # Now repeat tests while replaying forward. # Register variable, forward - -set breakloc [gdb_get_line_number \ - "register_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc" - -gdb_test "print a" ".* = 0$newline" "register var forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "register var forward step-to" -gdb_test "step" ".* register post-change .*" "" -gdb_test "print a" ".* = 1$newline" \ - "register var step post-change, second time" +with_test_prefix "register variable, forward" { + set breakloc [gdb_get_line_number \ + "register_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" + + gdb_test "print a" " = 0$newline" "register var forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " = 0$newline" "register var forward step-to" + gdb_test "step" " register post-change .*" "step, 2" + gdb_test "print a" " = 1$newline" \ + "register var step post-change, second time" +} # Auto variable, forward - -set breakloc [gdb_get_line_number \ - "auto_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc" - -gdb_test "print a" ".* = 0$newline" "auto var forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "auto var forward step-to" -gdb_test "step" ".* auto post-change .*" "" -gdb_test "print a" ".* = 1$newline" "auto var step post-change" +with_test_prefix "auto variable, forward" { + set breakloc [gdb_get_line_number \ + "auto_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" + + gdb_test "print a" " = 0$newline" "auto var forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " = 0$newline" "auto var forward step-to" + gdb_test "step" " auto post-change .*" "step, 2" + gdb_test "print a" " = 1$newline" "auto var step post-change" +} # Function static variable, forward - -set breakloc [gdb_get_line_number \ - "function_static_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc" - -gdb_test "print a" ".* = 0$newline" "function static forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "function static forward step-to" -gdb_test "step" ".* function static post-change .*" "" -gdb_test "print a" ".* = 1$newline" "function static step post-change" +with_test_prefix "function static variable, forward" { + set breakloc [gdb_get_line_number \ + "function_static_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" + + gdb_test "print a" " = 0$newline" "function static forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " = 0$newline" "function static forward step-to" + gdb_test "step" " function static post-change .*" "step, 2" + gdb_test "print a" " = 1$newline" "function static step post-change" +} # Module static variable, forward - -set breakloc [gdb_get_line_number \ - "module_static_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc" - -gdb_test "print astatic" ".* = 0$newline" "module static forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print astatic" ".* = 0$newline" "module static forward step-to" -gdb_test "step" ".* module static post-change .*" "" -gdb_test "print astatic" ".* = 1$newline" "module static step post-change" +with_test_prefix "module static variable, forward" { + set breakloc [gdb_get_line_number \ + "module_static_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" + + gdb_test "print astatic" " = 0$newline" "module static forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print astatic" " = 0$newline" "module static forward step-to" + gdb_test "step" " module static post-change .*" "step, 2" + gdb_test "print astatic" " = 1$newline" "module static step post-change" +} # Module global variable, forward - -set breakloc [gdb_get_line_number \ - "module_global_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc" - -gdb_test "print aglobal" ".* = 0$newline" "module global forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print aglobal" ".* = 0$newline" "module global forward step-to" -gdb_test "step" ".* module global post-change .*" "" -gdb_test "print aglobal" ".* = 1$newline" "module global step post-change" +with_test_prefix "module global variable, forward" { + set breakloc [gdb_get_line_number \ + "module_global_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" + + gdb_test "print aglobal" " = 0$newline" "module global forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print aglobal" " = 0$newline" "module global forward step-to" + gdb_test "step" " module global post-change .*" "step, 2" + gdb_test "print aglobal" " = 1$newline" "module global step post-change" +} diff --git a/gdb/testsuite/gdb.reverse/machinestate.exp b/gdb/testsuite/gdb.reverse/machinestate.exp index 27916c7a847..e33be3dbfed 100644 --- a/gdb/testsuite/gdb.reverse/machinestate.exp +++ b/gdb/testsuite/gdb.reverse/machinestate.exp @@ -63,7 +63,8 @@ if [supports_process_record] { # Proceed to end of main gdb_test "break $endmain" \ - "Breakpoint.* file .*$srcfile, line $endmain.*" "" + "Breakpoint.* file .*$srcfile, line $endmain.*" \ + "break at end of main" gdb_continue_to_breakpoint "end of main" ".*$srcfile:$endmain.*" ### @@ -74,157 +75,166 @@ gdb_continue_to_breakpoint "end of main" ".*$srcfile:$endmain.*" # # Module global variable, reverse - -set breakloc [gdb_get_line_number \ - "module_global_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc" - -gdb_test "print aglobal" ".* = 0$newline" "module global reverse-breakpoint" -gdb_test "step" ".* module global post-change .*" "" -gdb_test "print aglobal" ".* = 1$newline" "module global forward past bp" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print aglobal" ".* = 0$newline" "module global reverse-step to bp" - +with_test_prefix "module global variable, reverse" { + set breakloc [gdb_get_line_number \ + "module_global_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" + + gdb_test "print aglobal" " = 0$newline" "module global reverse-breakpoint" + gdb_test "step" " module global post-change .*" + gdb_test "print aglobal" " = 1$newline" "module global forward past bp" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print aglobal" " = 0$newline" "module global reverse-step to bp" +} # Module static variable, reverse - -set breakloc [gdb_get_line_number \ - "module_static_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc" - -gdb_test "print astatic" ".* = 0$newline" "module static reverse-breakpoint" -gdb_test "step" ".* module static post-change .*" "" -gdb_test "print astatic" ".* = 1$newline" "module static forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print astatic" ".* = 0$newline" "module static reverse-step" +with_test_prefix "module static variable, reverse" { + set breakloc [gdb_get_line_number \ + "module_static_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" + + gdb_test "print astatic" " = 0$newline" "module static reverse-breakpoint" + gdb_test "step" " module static post-change .*" + gdb_test "print astatic" " = 1$newline" "module static forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print astatic" " = 0$newline" "module static reverse-step" +} # Function static variable, reverse - -set breakloc [gdb_get_line_number \ - "function_static_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc" - -gdb_test "print a" ".* = 0$newline" "function static reverse-breakpoint" -gdb_test "step" ".* function static post-change .*" "" -gdb_test "print a" ".* = 1$newline" "function static forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "function static reverse-step" +with_test_prefix "function static variable, reverse" { + set breakloc [gdb_get_line_number \ + "function_static_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" + + gdb_test "print a" " = 0$newline" "function static reverse-breakpoint" + gdb_test "step" " function static post-change .*" + gdb_test "print a" " = 1$newline" "function static forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " = 0$newline" "function static reverse-step" +} # Auto variable, reverse - -set breakloc [gdb_get_line_number \ - "auto_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc" - -gdb_test "print a" ".* = 0$newline" "auto var reverse-breakpoint" -gdb_test "step" ".* auto post-change .*" "" -gdb_test "print a" ".* = 1$newline" "auto var forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "auto var reverse-step" +with_test_prefix "auto variable, reverse" { + set breakloc [gdb_get_line_number \ + "auto_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" + + gdb_test "print a" " = 0$newline" "auto var reverse-breakpoint" + gdb_test "step" " auto post-change .*" + gdb_test "print a" " = 1$newline" "auto var forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " = 0$newline" "auto var reverse-step" +} # Register variable, reverse - -set breakloc [gdb_get_line_number \ - "register_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "reverse-continue" ".*$srcfile:$breakloc.*" "reverse to $breakloc" - -gdb_test "print a" ".* = 0$newline" "register var reverse-breakpoint" -gdb_test "step" ".* register post-change .*" "" -gdb_test "print a" ".* = 1$newline" "register var step post-change" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" \ - "register var reverse step-to, first time" +with_test_prefix "register variable, reverse" { + set breakloc [gdb_get_line_number \ + "register_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" + + gdb_test "print a" " = 0$newline" "register var reverse-breakpoint" + gdb_test "step" " register post-change .*" + gdb_test "print a" " = 1$newline" "register var step post-change" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " = 0$newline" \ + "register var reverse step-to, first time" +} # Proceed to beginning of main -gdb_test "tbreak $beginmain" ".*$srcfile, line $beginmain.*" "" -gdb_test "reverse-continue" ".*$srcfile:$beginmain.*" "reverse to main" +gdb_test "tbreak $beginmain" "$srcfile, line $beginmain.*" +gdb_test "reverse-continue" "$srcfile:$beginmain.*" "reverse to main" # Now repeat tests while replaying forward. # Register variable, forward -set breakloc [gdb_get_line_number \ - "register_state: set breakpoint here" $srcfile] +with_test_prefix "register variable, forward" { + set breakloc [gdb_get_line_number \ + "register_state: set breakpoint here" $srcfile] -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc" + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" -gdb_test "print a" ".* = 0$newline" "register var forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "register var forward step-to" -gdb_test "step" ".* register post-change .*" "" -gdb_test "print a" ".* = 1$newline" \ - "register var step post-change, second time" + gdb_test "print a" " = 0$newline" "register var forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " = 0$newline" "register var forward step-to" + gdb_test "step" " register post-change .*" "step, 2" + gdb_test "print a" " = 1$newline" \ + "register var step post-change, second time" +} # Auto variable, forward - -set breakloc [gdb_get_line_number \ - "auto_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc" - -gdb_test "print a" ".* = 0$newline" "auto var forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "auto var forward step-to" -gdb_test "step" ".* auto post-change .*" "" -gdb_test "print a" ".* = 1$newline" "auto var step post-change" +with_test_prefix "auto variable, forward" { + set breakloc [gdb_get_line_number \ + "auto_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" + + gdb_test "print a" " = 0$newline" "auto var forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " = 0$newline" "auto var forward step-to" + gdb_test "step" " auto post-change .*" "step, 2" + gdb_test "print a" " = 1$newline" "auto var step post-change" +} # Function static variable, forward - -set breakloc [gdb_get_line_number \ - "function_static_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc" - -gdb_test "print a" ".* = 0$newline" "function static forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* = 0$newline" "function static forward step-to" -gdb_test "step" ".* function static post-change .*" "" -gdb_test "print a" ".* = 1$newline" "function static step post-change" +with_test_prefix "function static variable, forward" { + set breakloc [gdb_get_line_number \ + "function_static_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" + + gdb_test "print a" " = 0$newline" "function static forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " = 0$newline" "function static forward step-to" + gdb_test "step" " function static post-change .*" "step, 2" + gdb_test "print a" " = 1$newline" "function static step post-change" +} # Module static variable, forward - -set breakloc [gdb_get_line_number \ - "module_static_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc" - -gdb_test "print astatic" ".* = 0$newline" "module static forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print astatic" ".* = 0$newline" "module static forward step-to" -gdb_test "step" ".* module static post-change .*" "" -gdb_test "print astatic" ".* = 1$newline" "module static step post-change" +with_test_prefix "module static variable, forward" { + set breakloc [gdb_get_line_number \ + "module_static_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" + + gdb_test "print astatic" " = 0$newline" "module static forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print astatic" " = 0$newline" "module static forward step-to" + gdb_test "step" " module static post-change .*" "step, 2" + gdb_test "print astatic" " = 1$newline" "module static step post-change" +} # Module global variable, forward - -set breakloc [gdb_get_line_number \ - "module_global_state: set breakpoint here" $srcfile] - -gdb_test "tbreak $breakloc" ".*$srcfile, line $breakloc.*" "" -gdb_test "continue" ".*$srcfile:$breakloc.*" "forward to $breakloc" - -gdb_test "print aglobal" ".* = 0$newline" "module global forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print aglobal" ".* = 0$newline" "module global forward step-to" -gdb_test "step" ".* module global post-change .*" "" -gdb_test "print aglobal" ".* = 1$newline" "module global step post-change" - +with_test_prefix "module global variable, forward" { + set breakloc [gdb_get_line_number \ + "module_global_state: set breakpoint here" $srcfile] + + gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" + gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" + + gdb_test "print aglobal" " = 0$newline" "module global forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print aglobal" " = 0$newline" "module global forward step-to" + gdb_test "step" " module global post-change .*" "step, 2" + gdb_test "print aglobal" " = 1$newline" "module global step post-change" +} diff --git a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp index 8dc9af05c8e..7932c0a82e6 100644 --- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp +++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp @@ -142,10 +142,9 @@ proc test { non_stop } { proc my_gdb_test {cmd pattern message} { upvar inf inf upvar iter iter - if {[gdb_test_multiple $cmd "access mem ($message, inf=$inf, iter=$iter)" { - -wrap -re $pattern { - } - }] != 0} { + if {[gdb_test -nopass \ + $cmd $pattern "access mem ($message, inf=$inf, iter=$iter)"] \ + != 0} { uplevel 1 {set ok 0} return -code break } @@ -161,7 +160,7 @@ proc test { non_stop } { while {!$::done && $ok} { incr iter verbose -log "xxxxx: iteration $iter" - gdb_test "info threads" ".*" "" + gdb_test -nopass "info threads" if {$inf == 1} { set inf 2 diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp index b4a255fe00e..11bfad4510e 100644 --- a/gdb/testsuite/gdb.threads/attach-into-signal.exp +++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp @@ -99,7 +99,7 @@ proc corefunc { threadtype executable } { break } - gdb_test "detach" "Detaching from.*" "" + gdb_test -nopass "detach" "Detaching from.*" } if {$passes < 3} { diff --git a/gdb/testsuite/gdb.threads/sigstep-threads.exp b/gdb/testsuite/gdb.threads/sigstep-threads.exp index 11ea3bccf4b..bad3ac72a98 100644 --- a/gdb/testsuite/gdb.threads/sigstep-threads.exp +++ b/gdb/testsuite/gdb.threads/sigstep-threads.exp @@ -55,10 +55,10 @@ for {set i 0} {$i < 100} {incr i} { } elseif {$step_at == 1 && $now == 2} { set failed 0 # Continue over the re-signalling back to the handle entry. - gdb_test_no_output {enable $step1} "" - gdb_test "continue" " step-1 .*" "" + gdb_test_no_output -nopass {enable $step1} + gdb_test -nopass "continue" " step-1 .*" set now 1 - gdb_test_no_output {disable $step1} "" + gdb_test_no_output -nopass {disable $step1} } else { fail $test } diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp index e686b930926..c14fb27e3f6 100644 --- a/gdb/testsuite/gdb.trace/actions.exp +++ b/gdb/testsuite/gdb.trace/actions.exp @@ -246,7 +246,7 @@ gdb_load $binfile # created above. gdb_breakpoint "main" gdb_run_cmd -if {[gdb_test "" "Breakpoint .*"] != 0} { +if {[gdb_test "" "Breakpoint .*" "run to main"] != 0} { return -1 } diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp index 77d6a608287..ec068b20d4a 100644 --- a/gdb/testsuite/gdb.trace/backtrace.exp +++ b/gdb/testsuite/gdb.trace/backtrace.exp @@ -263,86 +263,86 @@ gdb_tfind_test "init: make sure not debugging any trace frame" "none" "-1" gdb_tfind_test "8.6: find start frame" "start" "0" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp2:" "" + "TDP $tdp2:" "printf TDP start" gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 1, collect nothing" gdb_tfind_test "8.6: find frame 1" "1" "1" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp3:" "" + "TDP $tdp3:" "printf TDP frame 1" gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 1, collect regs" gdb_tfind_test "8.6: find frame 2" "2" "2" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp4:" "" + "TDP $tdp4:" "printf TDP frame 2" gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 1, collect args and locals" gdb_tfind_test "8.6: find frame 4" "4" "4" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp6:" "" + "TDP $tdp6:" "printf TDP frame 4" gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 4 gdb_tfind_test "8.6: find frame 5" "5" "5" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp2:" "" + "TDP $tdp2:" "printf TDP frame 5" gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 2, collect nothing" gdb_tfind_test "8.6: find frame 6" "6" "6" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp3:" "" + "TDP $tdp3:" "printf TDP frame 6" gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 2, collect regs" gdb_tfind_test "8.6: find frame 7" "7" "7" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp4:" "" + "TDP $tdp4:" "printf TDP frame 7" gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 2, collect args and locals" gdb_tfind_test "8.6: find frame 9" "9" "9" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp6:" "" + "TDP $tdp6:" "printf TDP frame 9" gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 9 gdb_tfind_test "8.6: find frame 10" "10" "10" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp2:" "" + "TDP $tdp2:" "printf TDP frame 10" gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 3, collect nothing" gdb_tfind_test "8.6: find frame 11" "11" "11" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp3:" "" + "TDP $tdp3:" "printf TDP frame 11" gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 3, collect regs" gdb_tfind_test "8.6: find frame 12" "12" "12" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp4:" "" + "TDP $tdp4:" "printf TDP frame 12" gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 3, collect args and locals" gdb_tfind_test "8.6: find frame 14" "14" "14" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp6:" "" + "TDP $tdp6:" "printf TDP frame 14" gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 14 gdb_tfind_test "8.6: find frame 15" "15" "15" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp2:" "" + "TDP $tdp2:" "printf TDP frame 15" gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 4, collect nothing" gdb_tfind_test "8.6: find frame 16" "16" "16" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp3:" "" + "TDP $tdp3:" "printf TDP frame 16" gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 4, collect regs" gdb_tfind_test "8.6: find frame 17" "17" "17" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp4:" "" + "TDP $tdp4:" "printf TDP frame 17" gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 4, collect args and locals" gdb_tfind_test "8.6: find frame 19" "19" "19" gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \ - "TDP $tdp6:" "" + "TDP $tdp6:" "printf TDP frame 19" gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 19 gdb_test "printf \"x \%d x\\n\", depth == 3" \ @@ -350,4 +350,4 @@ gdb_test "printf \"x \%d x\\n\", depth == 3" \ "1.13: trace in recursion: depth not equal to 3" # Finished! -gdb_test "tfind none" ".*" "" +gdb_test "tfind none" ".*" diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp index 0f8b7217271..c261b3c824d 100644 --- a/gdb/testsuite/gdb.trace/collection.exp +++ b/gdb/testsuite/gdb.trace/collection.exp @@ -68,29 +68,26 @@ proc prepare_for_trace_test {} { gdb_breakpoint "end" qualified } -proc run_trace_experiment { msg test_func } { +proc run_trace_experiment { test_func } { global gdb_prompt - gdb_test "continue" \ - ".*Breakpoint \[0-9\]+, begin .*" \ - "collect $msg: advance to begin" + with_test_prefix "run trace experiment" { + gdb_test "continue" \ + ".*Breakpoint \[0-9\]+, begin .*" \ + "advance to begin" - set test "collect $msg: start trace experiment" - gdb_test_multiple "tstart" "$test" { - -re "^tstart\r\n$gdb_prompt $" { - pass "$test" - } - } + gdb_test_no_output "tstart" "start trace experiment" - gdb_test "continue" \ + gdb_test "continue" \ "Continuing.*Breakpoint \[0-9\]+, end.*" \ - "collect $msg: run trace experiment" - gdb_test "tstop" \ + "run trace experiment" + gdb_test "tstop" \ "\[\r\n\]+" \ - "collect $msg: stop trace experiment" - gdb_test "tfind start" \ + "stop trace experiment" + gdb_test "tfind start" \ "#0 $test_func .*" \ - "collect $msg: tfind test frame" + "tfind test frame" + } } @@ -102,128 +99,136 @@ proc gdb_collect_args_test { myargs msg } { global cr global gdb_prompt - prepare_for_trace_test + with_test_prefix "collect $msg" { + prepare_for_trace_test - gdb_test "trace args_test_func" \ + gdb_test "trace args_test_func" \ "Tracepoint \[0-9\]+ at .*" \ - "collect $msg: set tracepoint" - gdb_trace_setactions "collect $msg: define actions" \ + "set tracepoint" + gdb_trace_setactions "define actions" \ "" \ "collect $myargs" "^$" - # Begin the test. - run_trace_experiment $msg args_test_func + # Begin the test. + run_trace_experiment args_test_func - # Frame arguments and their entry values are displayed correctly with - # various values of "print entry-values" when a trace frame is - # selected. + # Frame arguments and their entry values are displayed correctly with + # various values of "print entry-values" when a trace frame is + # selected. - gdb_test "tfind -1" ".*" "" - gdb_test_no_output "set print entry-values only" "" - gdb_test "tfind 0" \ - " \\(argc@entry=\[^,\]*, argi@entry=\[^,\]*, argf@entry=\[^,\]*, argd@entry=\[^,\]*, argstruct@entry=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \ - "collect $msg: tfind 0 with entry-values only" + with_test_prefix "entry-values only" { + gdb_test "tfind -1" ".*" + gdb_test_no_output "set print entry-values only" + gdb_test "tfind 0" \ + " \\(argc@entry=\[^,\]*, argi@entry=\[^,\]*, argf@entry=\[^,\]*, argd@entry=\[^,\]*, argstruct@entry=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \ + "tfind 0 with entry-values only" + } - gdb_test "tfind -1" ".*" "" - gdb_test_no_output "set print entry-values both" "" - gdb_test "tfind 0" \ - " \\(argc=\[^,\]*, argc@entry=\[^,\]*, argi=\[^,\]*, argi@entry=\[^,\]*, argf=\[^,\]*, argf@entry=\[^,\]*, argd=\[^,\]*, argd@entry=\[^,\]*, argstruct=\[^,\]*, argstruct@entry=\[^,\]*, argarray=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \ - "collect $msg: tfind 0 with entry-values both" + with_test_prefix "entry-values both" { + gdb_test "tfind -1" ".*" "" + gdb_test_no_output "set print entry-values both" "" + gdb_test "tfind 0" \ + " \\(argc=\[^,\]*, argc@entry=\[^,\]*, argi=\[^,\]*, argi@entry=\[^,\]*, argf=\[^,\]*, argf@entry=\[^,\]*, argd=\[^,\]*, argd@entry=\[^,\]*, argstruct=\[^,\]*, argstruct@entry=\[^,\]*, argarray=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \ + "tfind 0 with entry-values both" + } - gdb_test "print argc" \ + gdb_test "print argc" \ "\\$\[0-9\]+ = 1 '.001'$cr" \ - "collect $msg: collected arg char" - gdb_test "print argi" \ + "collected arg char" + gdb_test "print argi" \ "\\$\[0-9\]+ = 2$cr" \ - "collect $msg: collected arg int" - gdb_test "print argf" \ + "collected arg int" + gdb_test "print argf" \ "\\$\[0-9\]+ = 3.\[23\]\[0-9\]*$cr" \ - "collect $msg: collected arg float" - gdb_test "print argd" \ + "collected arg float" + gdb_test "print argd" \ "\\$\[0-9\]+ = 4.\[34\]\[0-9\]*$cr" \ - "collect $msg: collected arg double" + "collected arg double" - # struct arg as one of several args (near end of list) - gdb_test "print argstruct.memberc" \ + # struct arg as one of several args (near end of list) + gdb_test "print argstruct.memberc" \ "\\$\[0-9\]+ = 101 'e'$cr" \ - "collect $msg: collected arg struct member char" - gdb_test "print argstruct.memberi" \ + "collected arg struct member char" + gdb_test "print argstruct.memberi" \ "\\$\[0-9\]+ = 102$cr" \ - "collect $msg: collected arg struct member int" - gdb_test "print argstruct.memberf" \ + "collected arg struct member int" + gdb_test "print argstruct.memberf" \ "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*$cr" \ - "collect $msg: collected arg struct member float" - gdb_test "print argstruct.memberd" \ + "collected arg struct member float" + gdb_test "print argstruct.memberd" \ "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*$cr" \ - "collect $msg: collected arg struct member double" + "collected arg struct member double" - # array arg as one of several args (near end of list) + # array arg as one of several args (near end of list) - # It isn't clear why is the test assuming the array's elements are - # collected. In C, an array as function parameters is a special - # case; it's just a pointer into the caller's array, and as such, - # that's what normally the debug info describes. Maybe this was - # originaly written for a compiler where array parameters were - # really described as arrays in debug info. + # It isn't clear why is the test assuming the array's elements are + # collected. In C, an array as function parameters is a special + # case; it's just a pointer into the caller's array, and as such, + # that's what normally the debug info describes. Maybe this was + # originaly written for a compiler where array parameters were + # really described as arrays in debug info. - setup_xfail "*-*-*" - gdb_test "print argarray\[0\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[0\]" \ "\\$\[0-9\]+ = 111$cr" \ - "collect $msg: collected argarray #0" + "collected argarray #0" - setup_xfail "*-*-*" - gdb_test "print argarray\[1\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[1\]" \ "\\$\[0-9\]+ = 112$cr" \ - "collect $msg: collected argarray #1" + "collected argarray #1" - setup_xfail "*-*-*" - gdb_test "print argarray\[2\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[2\]" \ "\\$\[0-9\]+ = 113$cr" \ - "collect $msg: collected argarray #2" + "collected argarray #2" - setup_xfail "*-*-*" - gdb_test "print argarray\[3\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[3\]" \ "\\$\[0-9\]+ = 114$cr" \ - "collect $msg: collected argarray #3" + "collected argarray #3" - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } proc gdb_collect_argstruct_test { myargs msg } { global cr global gdb_prompt - prepare_for_trace_test + with_test_prefix "collect $msg" { + prepare_for_trace_test - gdb_test "trace argstruct_test_func" \ + gdb_test "trace argstruct_test_func" \ "Tracepoint \[0-9\]+ at .*" \ - "collect $msg: set tracepoint" - gdb_trace_setactions "collect $msg: define actions" \ + "set tracepoint" + gdb_trace_setactions "define actions" \ "" \ "collect $myargs" "^$" - # Begin the test. - run_trace_experiment $msg argstruct_test_func + # Begin the test. + run_trace_experiment argstruct_test_func - # struct argument as only argument - gdb_test "print argstruct.memberc" \ + # struct argument as only argument + gdb_test "print argstruct.memberc" \ "\\$\[0-9\]+ = 101 'e'$cr" \ - "collect $msg: collected arg struct member char" - gdb_test "print argstruct.memberi" \ + "collected arg struct member char" + gdb_test "print argstruct.memberi" \ "\\$\[0-9\]+ = 102$cr" \ - "collect $msg: collected arg struct member int" - gdb_test "print argstruct.memberf" \ + "collected arg struct member int" + gdb_test "print argstruct.memberf" \ "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*$cr" \ - "collect $msg: collected arg struct member float" - gdb_test "print argstruct.memberd" \ + "collected arg struct member float" + gdb_test "print argstruct.memberd" \ "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*$cr" \ - "collect $msg: collected arg struct member double" + "collected arg struct member double" - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } @@ -231,50 +236,53 @@ proc gdb_collect_argarray_test { myargs msg } { global cr global gdb_prompt - prepare_for_trace_test + with_test_prefix "collect $msg" { - gdb_test "trace argarray_test_func" \ + prepare_for_trace_test + + gdb_test "trace argarray_test_func" \ "Tracepoint \[0-9\]+ at .*" \ - "collect $msg: set tracepoint" - gdb_trace_setactions "collect $msg: define actions" \ + "set tracepoint" + gdb_trace_setactions "define actions" \ "" \ "collect $myargs" "^$" - # Begin the test. - run_trace_experiment $msg argarray_test_func + # Begin the test. + run_trace_experiment argarray_test_func - # array arg as only argument + # array arg as only argument - # It isn't clear why is the test assuming the array's elements are - # collected. In C, an array as function parameters is a special - # case; it's just a pointer into the caller's array, and as such, - # that's what normally the debug info describes. Maybe this was - # originaly written for a compiler where array parameters were - # really described as arrays in debug info. + # It isn't clear why is the test assuming the array's elements + # are collected. In C, an array as function parameters is a + # special case; it's just a pointer into the caller's array, + # and as such, that's what normally the debug info describes. + # Maybe this was originaly written for a compiler where array + # parameters were really described as arrays in debug info. - setup_xfail "*-*-*" - gdb_test "print argarray\[0\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[0\]" \ "\\$\[0-9\]+ = 111$cr" \ - "collect $msg: collected argarray #0" + "collected argarray #0" - setup_xfail "*-*-*" - gdb_test "print argarray\[1\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[1\]" \ "\\$\[0-9\]+ = 112$cr" \ - "collect $msg: collected argarray #1" + "collected argarray #1" - setup_xfail "*-*-*" - gdb_test "print argarray\[2\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[2\]" \ "\\$\[0-9\]+ = 113$cr" \ - "collect $msg: collected argarray #2" + "collected argarray #2" - setup_xfail "*-*-*" - gdb_test "print argarray\[3\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[3\]" \ "\\$\[0-9\]+ = 114$cr" \ - "collect $msg: collected argarray #3" + "collected argarray #3" - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } @@ -282,78 +290,79 @@ proc gdb_collect_locals_test { func mylocs msg } { global cr global gdb_prompt - prepare_for_trace_test - - # Find the comment-identified line for setting this tracepoint. - set testline 0 - gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint line" { - -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { - set testline $expect_out(1,string) - pass "collect $msg: find tracepoint line" + with_test_prefix "collect $msg" { + prepare_for_trace_test + + # Find the comment-identified line for setting this tracepoint. + set testline 0 + gdb_test_multiple "list $func, +30" "find tracepoint line" { + -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { + set testline $expect_out(1,string) + pass $gdb_test_name + } + -re ".*$gdb_prompt " { + fail "$gdb_test_name (skipping locals test)" + return + } + timeout { + fail "$gdb_test_name (skipping locals test)" + return + } } - -re ".*$gdb_prompt " { - fail "collect $msg: find tracepoint line (skipping locals test)" - return - } - timeout { - fail "collect $msg: find tracepoint line (skipping locals test)" - return - } - } - gdb_test "trace $testline" \ + gdb_test "trace $testline" \ "Tracepoint \[0-9\]+ at .*" \ - "collect $msg: set tracepoint" - gdb_trace_setactions "collect $msg: define actions" \ + "set tracepoint" + gdb_trace_setactions "define actions" \ "" \ "collect $mylocs" "^$" - # Begin the test. - run_trace_experiment $msg $func + # Begin the test. + run_trace_experiment $func - gdb_test "print locc" \ - "\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'$cr" \ - "collect $msg: collected local char" - gdb_test "print loci" \ + gdb_test "print locc" \ + "\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'$cr" \ + "collected local char" + gdb_test "print loci" \ "\\$\[0-9\]+ = 12$cr" \ - "collect $msg: collected local int" - gdb_test "print locf" \ + "collected local int" + gdb_test "print locf" \ "\\$\[0-9\]+ = 13.\[23\]\[0-9\]*$cr" \ - "collect $msg: collected local float" - gdb_test "print locd" \ + "collected local float" + gdb_test "print locd" \ "\\$\[0-9\]+ = 14.\[34\]\[0-9\]*$cr" \ - "collect $msg: collected local double" + "collected local double" - gdb_test "print locst.memberc" \ + gdb_test "print locst.memberc" \ "\\$\[0-9\]+ = 15 '.017'$cr" \ - "collect $msg: collected local member char" - gdb_test "print locst.memberi" \ + "collected local member char" + gdb_test "print locst.memberi" \ "\\$\[0-9\]+ = 16$cr" \ - "collect $msg: collected local member int" - gdb_test "print locst.memberf" \ + "collected local member int" + gdb_test "print locst.memberf" \ "\\$\[0-9\]+ = 17.\[67\]\[0-9\]*$cr" \ - "collect $msg: collected local member float" - gdb_test "print locst.memberd" \ + "collected local member float" + gdb_test "print locst.memberd" \ "\\$\[0-9\]+ = 18.\[78\]\[0-9\]*$cr" \ - "collect $msg: collected local member double" + "collected local member double" - gdb_test "print locar\[0\]" \ + gdb_test "print locar\[0\]" \ "\\$\[0-9\]+ = 121$cr" \ - "collect $msg: collected locarray #0" - gdb_test "print locar\[1\]" \ + "collected locarray #0" + gdb_test "print locar\[1\]" \ "\\$\[0-9\]+ = 122$cr" \ - "collect $msg: collected locarray #1" - gdb_test "print locar\[2\]" \ + "collected locarray #1" + gdb_test "print locar\[2\]" \ "\\$\[0-9\]+ = 123$cr" \ - "collect $msg: collected locarray #2" - gdb_test "print locar\[3\]" \ + "collected locarray #2" + gdb_test "print locar\[3\]" \ "\\$\[0-9\]+ = 124$cr" \ - "collect $msg: collected locarray #3" - + "collected locarray #3" - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } proc gdb_collect_registers_test { myregs } { @@ -363,26 +372,28 @@ proc gdb_collect_registers_test { myregs } { global spreg global pcreg - prepare_for_trace_test + with_test_prefix "collect $myregs" { + prepare_for_trace_test - # We'll simply re-use the args_test_function for this test - gdb_test "trace args_test_func" \ + # We'll simply re-use the args_test_function for this test + gdb_test "trace args_test_func" \ "Tracepoint \[0-9\]+ at .*" \ - "collect $myregs: set tracepoint" - gdb_trace_setactions "collect $myregs: define actions" \ + "set tracepoint" + gdb_trace_setactions "define actions" \ "" \ "collect $myregs" "^$" - # Begin the test. - run_trace_experiment $myregs args_test_func + # Begin the test. + run_trace_experiment args_test_func - test_register "\$$fpreg" $myregs - test_register "\$$spreg" $myregs - test_register "\$$pcreg" $myregs + test_register "\$$fpreg" $myregs + test_register "\$$spreg" $myregs + test_register "\$$pcreg" $myregs - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $myregs: cease trace debugging" + "cease trace debugging" + } } proc gdb_collect_expression_test { func expr val msg } { @@ -391,83 +402,86 @@ proc gdb_collect_expression_test { func expr val msg } { prepare_for_trace_test - # Find the comment-identified line for setting this tracepoint. - set testline 0 - gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint line" { - -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { - set testline $expect_out(1,string) - pass "collect $msg: find tracepoint line" + with_test_prefix "collect $msg" { + # Find the comment-identified line for setting this tracepoint. + set testline 0 + gdb_test_multiple "list $func, +30" "find tracepoint line" { + -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { + set testline $expect_out(1,string) + pass $gdb_test_name + } + -re ".*$gdb_prompt " { + pass "$gdb_test_name (skipping locals test)" + return + } + timeout { + pass "$gdb_test_name (skipping locals test)" + return + } } - -re ".*$gdb_prompt " { - fail "collect $msg: find tracepoint line (skipping locals test)" - return - } - timeout { - fail "collect $msg: find tracepoint line (skipping locals test)" - return - } - } - gdb_test "trace $testline" \ + gdb_test "trace $testline" \ "Tracepoint \[0-9\]+ at .*" \ - "collect $msg: set tracepoint" - gdb_trace_setactions "collect $msg: define actions" \ + "set tracepoint" + gdb_trace_setactions "define actions" \ "" \ "collect $expr" "^$" - # Begin the test. - run_trace_experiment $msg $func + # Begin the test. + run_trace_experiment $func - gdb_test "print $expr" \ + gdb_test "print $expr" \ "\\$\[0-9\]+ = $val$cr" \ - "collect $msg: got expected value '$val'" + "got expected value '$val'" - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } proc gdb_collect_globals_test { } { global cr global gdb_prompt - prepare_for_trace_test - - # Find the comment-identified line for setting this tracepoint. - set testline 0 - gdb_test_multiple "list globals_test_func, +30" "collect globals: find tracepoint line" { - -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { - set testline $expect_out(1,string) - pass "collect globals: find tracepoint line" - } - -re ".*$gdb_prompt " { - fail "collect globals: find tracepoint line (skipping global test)" - return + with_test_prefix "collect globals" { + prepare_for_trace_test + + # Find the comment-identified line for setting this tracepoint. + set testline 0 + gdb_test_multiple "list globals_test_func, +30" "find tracepoint line" { + -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { + set testline $expect_out(1,string) + pass $gdb_test_name + } + -re ".*$gdb_prompt " { + fail "$gdb_test_name (skipping global test)" + return + } + timeout { + fail "$gdb_test_name (skipping global test)" + return + } } - timeout { - fail "collect globals: find tracepoint line (skipping global test)" - return - } - } - # Use use this to test collecting overlapping memory ranges - # (making use of UNOP_MEMVAL, as objects don't usually overlap - # other objects). Note that globalarr2 should not be collected in - # any other way so that a regression test below can be effective. - - set globalarr2_addr "" - set test "get address of globalarr2" - gdb_test_multiple "p /x &globalarr2" $test { - -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" { - set globalarr2_addr $expect_out(1,string) - pass $test + # Use use this to test collecting overlapping memory ranges + # (making use of UNOP_MEMVAL, as objects don't usually overlap + # other objects). Note that globalarr2 should not be collected in + # any other way so that a regression test below can be effective. + + set globalarr2_addr "" + set test "get address of globalarr2" + gdb_test_multiple "p /x &globalarr2" $test { + -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" { + set globalarr2_addr $expect_out(1,string) + pass $test + } } - } - gdb_test "trace $testline" \ + gdb_test "trace $testline" \ "Tracepoint \[0-9\]+ at .*" \ - "collect globals: set tracepoint" - gdb_trace_setactions "collect globals: define actions" \ + "set tracepoint" + gdb_trace_setactions "define actions" \ "" \ "collect globalc, globali, globalf, globald" "^$" \ "collect globalstruct, globalp, globalarr" "^$" \ @@ -475,66 +489,67 @@ proc gdb_collect_globals_test { } { "collect \{int \[2\]\}$globalarr2_addr" "^$" \ "collect \{int \[4\]\}globalarr3" "^$" - # Begin the test. - run_trace_experiment "globals" globals_test_func + # Begin the test. + run_trace_experiment globals_test_func - gdb_test "print globalc" \ + gdb_test "print globalc" \ "\\$\[0-9\]+ = 71 'G'$cr" \ - "collect globals: collected global char" - gdb_test "print globali" \ + "collected global char" + gdb_test "print globali" \ "\\$\[0-9\]+ = 72$cr" \ - "collect globals: collected global int" - gdb_test "print globalf" \ + "collected global int" + gdb_test "print globalf" \ "\\$\[0-9\]+ = 73.\[23\]\[0-9\]*$cr" \ - "collect globals: collected global float" - gdb_test "print globald" \ + "collected global float" + gdb_test "print globald" \ "\\$\[0-9\]+ = 74.\[34\]\[0-9\]*$cr" \ - "collect globals: collected global double" + "collected global double" - gdb_test "print globalstruct.memberc" \ + gdb_test "print globalstruct.memberc" \ "\\$\[0-9\]+ = 81 'Q'$cr" \ - "collect globals: collected struct char member" - gdb_test "print globalstruct.memberi" \ + "collected struct char member" + gdb_test "print globalstruct.memberi" \ "\\$\[0-9\]+ = 82$cr" \ - "collect globals: collected struct member int" - gdb_test "print globalstruct.memberf" \ + "collected struct member int" + gdb_test "print globalstruct.memberf" \ "\\$\[0-9\]+ = 83.\[23\]\[0-9\]*$cr" \ - "collect globals: collected struct member float" - gdb_test "print globalstruct.memberd" \ + "collected struct member float" + gdb_test "print globalstruct.memberd" \ "\\$\[0-9\]+ = 84.\[34\]\[0-9\]*$cr" \ - "collect globals: collected struct member double" + "collected struct member double" - gdb_test "print globalp == &globalstruct" \ + gdb_test "print globalp == &globalstruct" \ "\\$\[0-9\]+ = 1$cr" \ - "collect globals: collected global pointer" + "collected global pointer" - gdb_test "print globalarr\[1\]" \ + gdb_test "print globalarr\[1\]" \ "\\$\[0-9\]+ = 1$cr" \ - "collect globals: collected global array element #1" - gdb_test "print globalarr\[2\]" \ + "collected global array element #1" + gdb_test "print globalarr\[2\]" \ "\\$\[0-9\]+ = 2$cr" \ - "collect globals: collected global array element #2" - gdb_test "print globalarr\[3\]" \ + "collected global array element #2" + gdb_test "print globalarr\[3\]" \ "\\$\[0-9\]+ = 3$cr" \ - "collect globals: collected global array element #3" - - # Check that we didn't mess up sort&merging memory ranges to - # collect. - gdb_test "print globalarr2" \ - "\\$\[0-9\]+ = \\{0, 1, 2, 3\\}$cr" \ - "collect globals: collected global array 2" - - # GDB would internal error collecting UNOP_MEMVAL's whose address - # expression wasn't an rvalue (that's regtested in the - # corresponding 'collect' action above). This just double checks - # we actually did collect what we wanted. - gdb_test "print globalarr3" \ - "\\$\[0-9\]+ = \\{3, 2, 1, 0\\}$cr" \ - "collect globals: collected global array 3" - - gdb_test "tfind none" \ + "collected global array element #3" + + # Check that we didn't mess up sort&merging memory ranges to + # collect. + gdb_test "print globalarr2" \ + "\\$\[0-9\]+ = \\{0, 1, 2, 3\\}$cr" \ + "collected global array 2" + + # GDB would internal error collecting UNOP_MEMVAL's whose address + # expression wasn't an rvalue (that's regtested in the + # corresponding 'collect' action above). This just double checks + # we actually did collect what we wanted. + gdb_test "print globalarr3" \ + "\\$\[0-9\]+ = \\{3, 2, 1, 0\\}$cr" \ + "collect globals: collected global array 3" + + gdb_test "tfind none" \ "#0 end .*" \ - "collect globals: cease trace debugging" + "cease trace debugging" + } } # Test that when we've collected all fields of a structure @@ -542,75 +557,78 @@ proc gdb_collect_globals_test { } { proc gdb_collect_global_in_pieces_test { } { global gdb_prompt - prepare_for_trace_test + with_test_prefix "collect global in pieces" { + prepare_for_trace_test - # Find the comment-identified line for setting this tracepoint. - set testline 0 - set msg "collect global in pieces: find tracepoint line" - gdb_test_multiple "list globals_test_func, +30" "$msg" { - -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { - set testline $expect_out(1,string) - pass "$msg" + # Find the comment-identified line for setting this tracepoint. + set testline 0 + gdb_test_multiple "list globals_test_func, +30" "find tracepoint line" { + -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { + set testline $expect_out(1,string) + pass $gdb_test_name + } } - } - if {$testline == 0} { - return - } + if {$testline == 0} { + return + } - gdb_test "trace $testline" \ - "Tracepoint \[0-9\]+ at .*" \ - "collect global in pieces: set tracepoint" - gdb_trace_setactions "collect global in pieces: define actions" \ + gdb_test "trace $testline" \ + "Tracepoint \[0-9\]+ at .*" \ + "set tracepoint" + gdb_trace_setactions "define actions" \ "" \ "collect global_pieces.a, global_pieces.b" \ "^$" - # Begin the test. - run_trace_experiment "global in pieces" globals_test_func + # Begin the test. + run_trace_experiment globals_test_func - gdb_test "print /x global_pieces.a" " = 0x12345678" \ - "collect global in pieces: print piece a" - gdb_test "print /x global_pieces.b" " = 0x87654321" \ - "collect global in pieces: print piece b" + gdb_test "print /x global_pieces.a" " = 0x12345678" \ + "print piece a" + gdb_test "print /x global_pieces.b" " = 0x87654321" \ + "print piece b" - gdb_test "print /x global_pieces" " = \{a = 0x12345678, b = 0x87654321\}" \ - "collect global in pieces: print whole object" + gdb_test "print /x global_pieces" " = \{a = 0x12345678, b = 0x87654321\}" \ + "print whole object" - gdb_test "tfind none" "#0 end .*" \ - "collect global in pieces: cease trace debugging" + gdb_test "tfind none" "#0 end .*" \ + "cease trace debugging" + } } proc gdb_collect_return_test { } { global gdb_prompt - prepare_for_trace_test + with_test_prefix "collect \$_ret" { + prepare_for_trace_test - # We'll simply re-use the args_test_function for this test - gdb_test "trace args_test_func" \ + # We'll simply re-use the args_test_function for this test. + gdb_test "trace args_test_func" \ "Tracepoint \[0-9\]+ at .*" \ - "collect \$_ret: set tracepoint" - gdb_trace_setactions "collect \$_ret: define actions" \ + "set tracepoint" + gdb_trace_setactions "define actions" \ "" \ "collect \$_ret" "^$" - # Begin the test. - run_trace_experiment \$_ret args_test_func - - # Since we can't guarantee that $_ret will give us the caller, - # pass either way, but giving different messages. - gdb_test_multiple "backtrace" "" { - -re ".*#1 .* in main .*\r\n$gdb_prompt $" { - pass "collect \$_ret: backtrace lists main" - } - -re ".*#1 .* in ?? .*\r\n$gdb_prompt $" { - pass "collect \$_ret: backtrace not listing main" + # Begin the test. + run_trace_experiment args_test_func + + # Since we can't guarantee that $_ret will give us the caller, + # pass either way, but giving different messages. + gdb_test_multiple "backtrace" "" { + -re ".*#1 .* in main .*\r\n$gdb_prompt $" { + pass "$gdb_test_name (lists main)" + } + -re ".*#1 .* in ?? .*\r\n$gdb_prompt $" { + pass "$gdb_test_name (not listing main)" + } } - } - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect \$_ret: cease trace debugging" + "cease trace debugging" + } } proc gdb_collect_strings_test { func mystr myrslt mylim msg } { @@ -618,42 +636,44 @@ proc gdb_collect_strings_test { func mystr myrslt mylim msg } { global cr global gdb_prompt - prepare_for_trace_test - - # Find the comment-identified line for setting this tracepoint. - set testline 0 - gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint line" { - -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { - set testline $expect_out(1,string) - pass "collect $msg: find tracepoint line" - } - -re ".*$gdb_prompt " { - fail "collect $msg: find tracepoint line (skipping strings test)" - return + with_test_prefix "collect $msg" { + prepare_for_trace_test + + # Find the comment-identified line for setting this tracepoint. + set testline 0 + gdb_test_multiple "list $func, +30" "find tracepoint line" { + -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { + set testline $expect_out(1,string) + pass $gdb_test_name + } + -re ".*$gdb_prompt " { + pass "$gdb_test_name (skipping strings test)" + return + } + timeout { + pass "$gdb_test_name (skipping strings test)" + return + } } - timeout { - fail "collect $msg: find tracepoint line (skipping strings test)" - return - } - } - gdb_test "trace $testline" \ + gdb_test "trace $testline" \ "Tracepoint \[0-9\]+ at .*" \ - "collect $msg: set tracepoint" - gdb_trace_setactions "collect $msg: define actions" \ + "set tracepoint" + gdb_trace_setactions "define actions" \ "" \ "collect/s$mylim $mystr" "^$" - # Begin the test. - run_trace_experiment $msg $func + # Begin the test. + run_trace_experiment $func - gdb_test "print $mystr" \ - "\\$\[0-9\]+ = $hex \"$myrslt\".*$cr" \ - "collect $msg: collected local string" + gdb_test "print $mystr" \ + "\\$\[0-9\]+ = $hex \"$myrslt\".*$cr" \ + "collected local string" - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } proc gdb_trace_collection_test {} { @@ -785,4 +805,4 @@ if { ![gdb_target_supports_trace] } then { gdb_trace_collection_test # Finished! -gdb_test "tfind none" ".*" "" +gdb_test "tfind none" ".*" diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp index ad12c2fa8c9..1504fb36508 100644 --- a/gdb/testsuite/gdb.trace/infotrace.exp +++ b/gdb/testsuite/gdb.trace/infotrace.exp @@ -107,7 +107,7 @@ gdb_breakpoint "main" gdb_trace_setactions "collect on tracepoint 1" "1" \ "collect gdb_struct1_test" "^$" gdb_run_cmd -if {[gdb_test "" "Breakpoint ${decimal}, main.*"] != 0} { +if {[gdb_test "" "Breakpoint ${decimal}, main.*" "run to main"] != 0} { return -1 } diff --git a/gdb/testsuite/gdb.trace/passc-dyn.exp b/gdb/testsuite/gdb.trace/passc-dyn.exp index 32fcecf4ad1..747e4207dd0 100644 --- a/gdb/testsuite/gdb.trace/passc-dyn.exp +++ b/gdb/testsuite/gdb.trace/passc-dyn.exp @@ -31,8 +31,6 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ return -1 } gdb_load $binfile -gdb_test "tstop" ".*" "" -gdb_test "tfind none" ".*" "" runto_main gdb_reinitialize_dir $srcdir/$subdir @@ -96,40 +94,40 @@ gdb_test "continue" \ "run trace experiment" gdb_test "tstop" ".*" "" -gdb_test "tfind none" ".*" "" -if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x -1 x" ""] { - untested "skipping further tests due to print failure" - return -1 +with_test_prefix "trace_frame -1" { + gdb_test "tfind none" ".*" + gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x -1 x" \ + "print \$trace_frame" } -gdb_test "tfind tracepoint $tdp2" ".*" "" -if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 0 x" ""] { - untested "skipping further tests due to print failure" - return -1 +with_test_prefix "trace_frame 0" { + gdb_test "tfind tracepoint $tdp2" ".*" + gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 0 x" \ + "print \$trace_frame" } -gdb_test "tfind tracepoint $tdp3" ".*" "" -if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 1 x" ""] { - untested "skipping further tests due to print failure" - return -1 +with_test_prefix "trace_frame 1" { + gdb_test "tfind tracepoint $tdp3" ".*" + gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 1 x" \ + "print \$trace_frame" } -gdb_test "tfind tracepoint $tdp4" ".*" "" -if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 2 x" ""] { - untested "skipping further tests due to print failure" - return -1 +with_test_prefix "trace_frame 2" { + gdb_test "tfind tracepoint $tdp4" ".*" + gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 2 x" \ + "print \$trace_frame" } -gdb_test "tfind tracepoint $tdp2" ".*" "" -if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 3 x" ""] { - untested "skipping further tests due to print failure" - return -1 +with_test_prefix "trace_frame 3" { + gdb_test "tfind tracepoint $tdp2" ".*" + gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 3 x" \ + "print \$trace_frame" } -gdb_test "tfind tracepoint $tdp3" ".*" "" -if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 4 x" ""] { - untested "skipping further tests due to print failure" - return -1 +with_test_prefix "trace_frame 4" { + gdb_test "tfind tracepoint $tdp3" ".*" + gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 4 x" \ + "print \$trace_frame" } ## We should now be at the last frame, because this frame's passcount @@ -139,5 +137,5 @@ if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 4 x" ""] { gdb_test "tfind" "failed to find.*" "4.5: dynamic passcount test" # Finished! -gdb_test "tfind none" ".*" "" +gdb_test "tfind none" ".*" diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp index b538f4eba1d..7b3678d29f3 100644 --- a/gdb/testsuite/gdb.trace/report.exp +++ b/gdb/testsuite/gdb.trace/report.exp @@ -32,8 +32,6 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ return -1 } gdb_load $binfile -gdb_test "tstop" ".*" "" -gdb_test "tfind none" ".*" "" runto_main gdb_reinitialize_dir $srcdir/$subdir diff --git a/gdb/testsuite/gdb.trace/tfind.exp b/gdb/testsuite/gdb.trace/tfind.exp index c987ab14e4d..57b7b2fad70 100644 --- a/gdb/testsuite/gdb.trace/tfind.exp +++ b/gdb/testsuite/gdb.trace/tfind.exp @@ -34,8 +34,6 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" \ return -1 } gdb_load $binfile -gdb_test "tstop" ".*" "" -gdb_test "tfind none" ".*" "" # 6.2 test help tstart gdb_test "help tstart" \ @@ -302,7 +300,7 @@ gdb_tfind_test "8.14: tfind 3" "3" "3" gdb_test "print \$trace_line" "$testline4" \ "8.14: tfind 3 (line $testline4)" -gdb_test_no_output "set \$test_pc = \$pc" "" +gdb_test_no_output "set \$test_pc = \$pc" "8.14: set \$test_pc" gdb_tfind_test "8.14: tfind none" "none" "-1" gdb_tfind_test "8.14: tfind pc" "pc \$test_pc" "\$trace_frame != -1" "1" gdb_test "print \$trace_line" "$testline4" \ @@ -316,7 +314,7 @@ gdb_test "printf \"x \%d x\\n\", \$pc == \$test_pc" \ gdb_tfind_test "8.15: tfind 3" "3" "3" gdb_test "print \$trace_line" "$testline4" \ "8.15: tfind 3 (line $testline4)" -gdb_test_no_output "set \$test_pc = \$pc" "" +gdb_test_no_output "set \$test_pc = \$pc" "8.15: set \$test_pc" gdb_tfind_test "8.15: tfind pc" "pc" "\$pc == \$test_pc" "1" gdb_test "print \$trace_line" "$testline4" \ "8.15: tfind pc (line $testline4)" @@ -367,4 +365,4 @@ gdb_test "tfind NoSuChOpTiOn 21" \ "8.32: tfind with bad subcommand" # Finished! -gdb_tfind_test "8.17: tfind none" "none" "-1" +gdb_tfind_test "tfind none" "none" "-1" diff --git a/gdb/testsuite/gdb.trace/tspeed.exp b/gdb/testsuite/gdb.trace/tspeed.exp index f44036edf7a..ba64176596b 100644 --- a/gdb/testsuite/gdb.trace/tspeed.exp +++ b/gdb/testsuite/gdb.trace/tspeed.exp @@ -74,11 +74,13 @@ proc prepare_for_trace_test {} { set testline [gdb_get_line_number "set pre-run breakpoint here"] - gdb_test "break $testline" ".*" "" + gdb_test "break $testline" ".*" \ + "break at pre-run" set testline [gdb_get_line_number "set post-run breakpoint here"] - gdb_test "break $testline" ".*" "" + gdb_test "break $testline" ".*" \ + "break at post-run" } proc run_trace_experiment {} { @@ -98,7 +100,7 @@ proc run_trace_experiment {} { gdb_test "tstop" "" "" } -proc gdb_slow_trace_speed_test { } { +proc_with_prefix gdb_slow_trace_speed_test { } { gdb_delete_tracepoints @@ -114,7 +116,7 @@ proc gdb_slow_trace_speed_test { } { run_trace_experiment } -proc gdb_fast_trace_speed_test { } { +proc_with_prefix gdb_fast_trace_speed_test { } { global gdb_prompt gdb_delete_tracepoints diff --git a/gdb/testsuite/gdb.trace/while-dyn.exp b/gdb/testsuite/gdb.trace/while-dyn.exp index ee8ba6b4b66..c77bad73c2d 100644 --- a/gdb/testsuite/gdb.trace/while-dyn.exp +++ b/gdb/testsuite/gdb.trace/while-dyn.exp @@ -33,8 +33,6 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ return -1 } gdb_load $binfile -gdb_test "tstop" ".*" "" -gdb_test "tfind none" ".*" "" runto_main gdb_reinitialize_dir $srcdir/$subdir @@ -53,49 +51,42 @@ proc test_while_stepping { while_stepping } { global gdb_prompt global executable - clean_restart $executable + with_test_prefix "$while_stepping" { + clean_restart $executable - gdb_test "tstop" ".*" "" - gdb_test "tfind none" ".*" "" - runto_main + runto_main - ## verify number of trace frames collected matches stepcount + ## verify number of trace frames collected matches stepcount - gdb_delete_tracepoints - gdb_test "trace gdb_c_test" \ - "Tracepoint $decimal at .*" \ - "$while_stepping: Set tracepoint at gdb_c_test" + gdb_delete_tracepoints + gdb_test "trace gdb_c_test" \ + "Tracepoint $decimal at .*" \ + "Set tracepoint at gdb_c_test" - gdb_trace_setactions "5.12: define $while_stepping " \ - "" \ - "collect \$$fpreg" "^$" \ - "$while_stepping 5" "^$" \ - "collect p" "^$" \ - "end" "^$" \ - "end" "" + gdb_trace_setactions "define $while_stepping " \ + "" \ + "collect \$$fpreg" "^$" \ + "$while_stepping 5" "^$" \ + "collect p" "^$" \ + "end" "^$" \ + "end" "" - gdb_test "tstart" ".*" "" + gdb_test "tstart" ".*" - gdb_breakpoint "end" qualified - gdb_test "continue" \ - "Continuing.*Breakpoint $decimal, end.*" \ - "$while_stepping: run trace experiment" + gdb_breakpoint "end" qualified + gdb_test "continue" \ + "Continuing.*Breakpoint $decimal, end.*" \ + "run trace experiment" - gdb_test "tstop" ".*" "" + gdb_test "tstop" ".*" - gdb_tfind_test "$while_stepping: frame 5 should be the last one collected" "5" "5" + gdb_tfind_test "frame 5 should be the last one collected" "5" "5" - set test "$while_stepping: trace stopped after 5 stepping frames" - gdb_test_multiple "tfind 6" "$test" { - -re "failed to find.*$gdb_prompt $" { - pass "$test" - } - -re ".*$gdb_prompt $" { - fail "$test" - } - } + gdb_test "tfind 6" "failed to find.*" \ + "trace stopped after 5 stepping frames" - gdb_test "tfind none" ".*" "" + gdb_test "tfind none" ".*" + } } # Test all while-stepping aliases. diff --git a/gdb/testsuite/gdb.trace/while-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp index 0dcccab8d2d..77641b8a130 100644 --- a/gdb/testsuite/gdb.trace/while-stepping.exp +++ b/gdb/testsuite/gdb.trace/while-stepping.exp @@ -111,7 +111,7 @@ gdb_load $binfile gdb_breakpoint "main" gdb_run_cmd -if {[gdb_test "" "Breakpoint .*"] != 0} { +if {[gdb_test "" "Breakpoint .*" "run to main"] != 0} { return -1 } diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp index 30d3461c226..0c03d0f035e 100644 --- a/gdb/testsuite/lib/completion-support.exp +++ b/gdb/testsuite/lib/completion-support.exp @@ -551,7 +551,7 @@ proc test_gdb_completion_offers_commands {input_line} { } # Force showing two commands. - gdb_test_no_output "set max-completions 2" "" + gdb_test_no_output -nopass "set max-completions 2" # TUI adds additional commands to the possible completions, so we # need different patterns depending on whether or not it is enabled. @@ -568,5 +568,5 @@ proc test_gdb_completion_offers_commands {input_line} { } # Restore. - gdb_test_no_output "set max-completions $max_completions" "" + gdb_test_no_output -nopass "set max-completions $max_completions" } diff --git a/gdb/testsuite/lib/gdb-guile.exp b/gdb/testsuite/lib/gdb-guile.exp index 1ba7a872cc3..b42409d96b4 100644 --- a/gdb/testsuite/lib/gdb-guile.exp +++ b/gdb/testsuite/lib/gdb-guile.exp @@ -82,22 +82,16 @@ proc gdb_install_guile_utils { } { # Define utilities in Guile to save needing (newline) all the time, # and in the case of "print" add a prefix to help erroneous passes. # - # Pass the empty string as the test name here, this means we don't - # get a pass/fail message for these tests, but also removes - # duplicate tests if this proc ends up getting called multiple - # times in a single test script. - gdb_test_no_output "guile (define (print x) (format #t \"= ~A\" x) (newline))" "" - gdb_test_no_output "guile (define (raw-print x) (format #t \"= ~S\" x) (newline))" "" + gdb_test_no_output -nopass \ + "guile (define (print x) (format #t \"= ~A\" x) (newline))" + gdb_test_no_output -nopass \ + "guile (define (raw-print x) (format #t \"= ~S\" x) (newline))" } # Install the gdb module. proc gdb_install_guile_module { } { - # Pass the empty string as the test name here, this means we don't - # get a pass/fail message for these tests, but also removes - # duplicate tests if this proc ends up getting called multiple - # times in a single test script. - gdb_test_no_output "guile (use-modules (gdb))" "" + gdb_test_no_output -nopass "guile (use-modules (gdb))" } # Wrapper around runto_main that installs the guile utils and module. diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 960c0eb2313..b04fbb89e4e 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2805,11 +2805,11 @@ proc with_target_charset { target_charset body } { } } - gdb_test_no_output "set target-charset $target_charset" "" + gdb_test_no_output -nopass "set target-charset $target_charset" set code [catch {uplevel 1 $body} result] - gdb_test_no_output "set target-charset $saved" "" + gdb_test_no_output -nopass "set target-charset $saved" if {$code == 1} { global errorInfo errorCode @@ -5597,14 +5597,14 @@ proc with_complaints { n body } { perror "Did not manage to set complaints" } else { # Set complaints. - gdb_test_no_output "set complaints $n" "" + gdb_test_no_output -nopass "set complaints $n" } set code [catch {uplevel 1 $body} result] # Restore saved setting of complaints. if { $save != "" } { - gdb_test_no_output "set complaints $save" "" + gdb_test_no_output -nopass "set complaints $save" } if {$code == 1} { diff --git a/gdb/testsuite/lib/range-stepping-support.exp b/gdb/testsuite/lib/range-stepping-support.exp index 92fccb596f7..5bef91d19b8 100644 --- a/gdb/testsuite/lib/range-stepping-support.exp +++ b/gdb/testsuite/lib/range-stepping-support.exp @@ -19,7 +19,7 @@ proc exec_cmd_expect_vCont_count { cmd exp_vCont_r } { global gdb_prompt - gdb_test_no_output "set debug remote 1" "" + gdb_test_no_output -nopass "set debug remote 1" set test "${cmd}: vCont;r=${exp_vCont_r}" set r_counter 0 @@ -49,7 +49,7 @@ proc exec_cmd_expect_vCont_count { cmd exp_vCont_r } { } } - gdb_test_no_output "set debug remote 0" "" + gdb_test_no_output -nopass "set debug remote 0" return $ret } diff --git a/gdb/testsuite/lib/trace-support.exp b/gdb/testsuite/lib/trace-support.exp index 32969858608..ccad22ecd99 100644 --- a/gdb/testsuite/lib/trace-support.exp +++ b/gdb/testsuite/lib/trace-support.exp @@ -253,7 +253,7 @@ proc gdb_tfind_test { testname tfind_arg exp_res args } { } set passfail "fail" - gdb_test "tfind $tfind_arg" "" "" + gdb_test -nopass "tfind $tfind_arg" "" send_gdb "printf \"x \%d x\\n\", $expr\n" gdb_expect 10 { -re "x (-*\[0-9\]+) x" { @@ -308,7 +308,7 @@ proc gdb_gettpnum { tracepoint } { global gdb_prompt if { $tracepoint != "" } { - gdb_test "trace $tracepoint" "" "" + gdb_test -nopass "trace $tracepoint" } return [gdb_readexpr "\$tpnum"] } -- 2.30.2