public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Pedro Alves <palves@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: Fix DUPLICATE and PATH regressions throughout Date: Wed, 25 May 2022 12:47:18 +0000 (GMT) [thread overview] Message-ID: <20220525124718.E8D3638618A5@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cce0ae568c7e30e0a7b8d1bd77f8c4b7d7b8ce7b commit cce0ae568c7e30e0a7b8d1bd77f8c4b7d7b8ce7b Author: Pedro Alves <pedro@palves.net> Date: Wed May 18 13:22:02 2022 +0100 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 Diff: --- 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/testsuite/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/testsuite/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 ++++---- .../gdb.threads/access-mem-running-thread-exit.exp | 9 +- gdb/testsuite/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<et width 30^M # (gdb) FAIL: gdb.base/style.exp: all styles enabled: set width 30 - gdb_test_no_output "set width 0" "" + gdb_test "with width $width -- frame" $re_styled \ + "frame when width=$width" } set macro_line [gdb_get_line_number "\#define SOME_MACRO"] @@ -254,7 +255,7 @@ proc run_style_tests { } { "short${cut_for_thre_expr}ad apply.*" \ ] - clean_restart_and_disable + clean_restart_and_disable "restart 2" set quoted [string_to_regexp $binfile] set pass_re "Reading symbols from [limited_style $quoted file]\.\.\." @@ -311,7 +312,7 @@ proc test_disable_disassembler_styling { } { # 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 3" $::binfile set styled_hex [limited_style $::hex address] set main [limited_style main function] diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp index 6941fd95102..4dbd3692995 100644 --- a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp +++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp @@ -67,8 +67,8 @@ foreach wpsize $sizes { fail $test } } - gdb_test_no_output "set variable size = $rdsize" "" - gdb_test_no_output "set variable offset = $rdoffset" "" + gdb_test_no_output -nopass "set variable size = $rdsize" + gdb_test_no_output -nopass "set variable offset = $rdoffset" set test "continue" set got_hit 0 gdb_test_multiple $test $test { @@ -80,7 +80,7 @@ foreach wpsize $sizes { -re " start_again .*\r\n$gdb_prompt $" { } } - gdb_test_no_output "delete $wpnum" "" + gdb_test_no_output -nopass "delete $wpnum" set test "wp(size=$wpsize offset=$wpoffset) rd(size=$rdsize offset=$rdoffset) expect=$expect_hit" if {$expect_hit == $got_hit} { pass $test @@ -119,8 +119,8 @@ foreach wpcount {4 7} { } } } - gdb_test_no_output "set variable size = 1" "" - gdb_test_no_output "set variable offset = 1" "" + gdb_test_no_output -nopass "set variable size = 1" + gdb_test_no_output -nopass "set variable offset = 1" set test "continue" set got_hit 0 gdb_test_multiple $test $test { diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 377d3f9ff43..97dee3a72b2 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -924,7 +924,8 @@ proc do_tests {} { clean_restart $testfile if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} { - gdb_test_no_output "set can-use-hw-watchpoints 0" "" + gdb_test_no_output "set can-use-hw-watchpoints 0"\ + "disable fast watches, 1" } if [initialize] then { @@ -943,7 +944,8 @@ proc do_tests {} { clean_restart $testfile if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} { - gdb_test_no_output "set can-use-hw-watchpoints 0" "" + gdb_test_no_output "set can-use-hw-watchpoints 0" \ + "disable fast watches, 2" } # Only enabled for some targets merely because it has not been tested diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp.tcl b/gdb/testsuite/gdb.cp/cpexprs.exp.tcl index 0a1a4abe69b..b4ed3cda80e 100644 --- a/gdb/testsuite/gdb.cp/cpexprs.exp.tcl +++ b/gdb/testsuite/gdb.cp/cpexprs.exp.tcl @@ -30,8 +30,7 @@ proc test_breakpoint {func} { fail "set test_function breakpoint for $func" } elseif { [gdb_test "continue" \ "Continuing.\r\n\r\nBreakpoint $DEC+,.*test_function.*" \ - ""] != 0 } { - fail "continue to test_function for $func" + "continue to test_function for $func"] != 0 } { } else { gdb_breakpoint "$func" set i [expr {[string last : $func] + 1}] diff --git a/gdb/testsuite/gdb.cp/static-method.exp b/gdb/testsuite/gdb.cp/static-method.exp index cd3171e0d53..efe56049239 100644 --- a/gdb/testsuite/gdb.cp/static-method.exp +++ b/gdb/testsuite/gdb.cp/static-method.exp @@ -28,8 +28,7 @@ proc test_breakpoint {func result} { fail "set test_function breakpoint for $func" } elseif {[gdb_test "continue" \ "Continuing.\r\n\r\nBreakpoint $DEC+,.*test_function.*" \ - ""] != 0} { - fail "continue to test_function for $func" + "continue to test_function for $func"] != 0} { } else { gdb_breakpoint "$func" gdb_test "continue" \ diff --git a/gdb/testsuite/gdb.reverse/insn-reverse.exp b/gdb/testsuite/gdb.reverse/insn-reverse.exp index 3b42a0fa8cc..c5437ecef6f 100644 --- a/gdb/testsuite/gdb.reverse/insn-reverse.exp +++ b/gdb/testsuite/gdb.reverse/insn-reverse.exp @@ -105,12 +105,12 @@ proc test { func testcase_nr } { } set pre_regs($count) [capture_command_output "info all-registers" ""] - gdb_test "si" "" "" + gdb_test -nopass "si" } # Registers contents after each backward single step. for {set i [expr $count - 1]} {$i >= 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" ""] { [...] [diff truncated at 100000 bytes]
reply other threads:[~2022-05-25 12:47 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220525124718.E8D3638618A5@sourceware.org \ --to=palves@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).