From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id E8D3638618A5; Wed, 25 May 2022 12:47:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E8D3638618A5 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: Fix DUPLICATE and PATH regressions throughout X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: aee9dcf8a836fe08e3d7f1b58a8b6dd2e16d9b68 X-Git-Newrev: cce0ae568c7e30e0a7b8d1bd77f8c4b7d7b8ce7b Message-Id: <20220525124718.E8D3638618A5@sourceware.org> Date: Wed, 25 May 2022 12:47:18 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2022 12:47:19 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dcce0ae568c7e= 30e0a7b8d1bd77f8c4b7d7b8ce7b commit cce0ae568c7e30e0a7b8d1bd77f8c4b7d7b8ce7b Author: Pedro Alves Date: Wed May 18 13:22:02 2022 +0100 gdb: Fix DUPLICATE and PATH regressions throughout =20 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: =20 gdb_test COMMAND PATTERN "" =20 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. =20 This commit fixes all the regressions I could see. =20 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. =20 See previous commit's log for more info. =20 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: =20 gdb_run_cmd gdb_test "" "Breakpoint $decimal, foo\\.nested_sub \\(\\).*" =20 was resulting in this in gdb.sum: =20 PASS: gdb.ada/bp_reset.exp: =20 I fixed such cases by passing an explicit message. We may want to make such cases error out. =20 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. =20 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. =20 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 =20 # Load the first executable. =20 -gdb_test "shell mv ${binfile} ${common_binfile}" ".*" "" +gdb_test "shell mv ${binfile} ${common_binfile}" "" \ + "shell mv \${binfile} \${common_binfile}" gdb_load ${common_binfile} =20 # 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. =20 -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}" =20 # 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 =20 -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" =20 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.*" \ =20 gdb_run_cmd -gdb_test "" "Breakpoint $decimal, foo \\(\\).*" +gdb_test "" "Breakpoint $decimal, foo \\(\\).*" \ + "run to foo" gdb_test "continue" \ "Continuing\\..*Breakpoint $decimal, foo \\(\\).*" =20 diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsui= te/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} { =20 gdb_run_cmd gdb_test "" \ - "Breakpoint $decimal, foo_o224_021\\.child1\\.child2 \\(s=3D\\.\\.\\.\\).= *" + "Breakpoint $decimal, foo_o224_021\\.child1\\.child2 \\(s=3D\\.\\.\\.\\).= *" \ + "run to foo_o224_021.child1.child2" =20 set opt_addr_in "($hex in)?" gdb_test "bt" \ diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.ba= se/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" =20 # 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" =20 # Check if we're using probes. set using_probes 0 diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/brea= k.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"= { =20 # Test with value history =20 -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" + } } } } =20 -gdb_test "enable" "" "" -gdb_test "set \$foo =3D 3" "" "" -gdb_test "set \$bar =3D 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 =3D 3" + gdb_test "set \$bar =3D 6" + gdb_test_no_output "disable \$foo \$bar" "disable with convenience val= ues" + + 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" + } } } } =20 # test with bad values =20 -gdb_test "enable" "" "" -gdb_test "disable 10" "No breakpoint number 10." \ - "disable non-existent breakpoint 10" - -gdb_test_no_output "set \$baz =3D 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 =3D 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" +} =20 # 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"] =20 gdb_breakpoint $break1_loc gdb_test "continue" "breakpoint 1.*" "break1 start" +gdb_test "checkpoint" "" "checkpoint one" =20 -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 two" +gdb_test "checkpoint" "" "checkpoint two" =20 -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 three" +gdb_test "checkpoint" "" "checkpoint three" =20 -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 four" +gdb_test "checkpoint" "" "checkpoint four" =20 -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 five" +gdb_test "checkpoint" "" "checkpoint five" =20 -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 six" +gdb_test "checkpoint" "" "checkpoint six" =20 -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 seven" +gdb_test "checkpoint" "" "checkpoint seven" =20 -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 eight" +gdb_test "checkpoint" "" "checkpoint eight" =20 -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 nine" +gdb_test "checkpoint" "" "checkpoint nine" =20 -gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 ten" - -gdb_test "checkpoint" ".*" "" +gdb_test "checkpoint" "" "checkpoint ten" =20 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 =20 gdb_test "restart 1" "Switching to .*c =3D=3D 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 =3D=3D EOF.*" "step in 1 two" gdb_test "print lines" " =3D 102.*" "verify lines 1 two" =20 gdb_test "restart 2" "Switching to .*c =3D=3D 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 =3D=3D EOF.*" "step in 2 two" gdb_test "print lines" " =3D 112.*" "verify lines 2 two" =20 gdb_test "restart 3" "Switching to .*c =3D=3D 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 =3D=3D EOF.*" "step in 3 two" gdb_test "print lines" " =3D 522.*" "verify lines 3 two" =20 gdb_test "restart 4" "Switching to .*c =3D=3D 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 =3D=3D EOF.*" "step in 4 two" gdb_test "print lines" " =3D 532.*" "verify lines 4 two" =20 gdb_test "restart 5" "Switching to .*c =3D=3D 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 =3D=3D EOF.*" "step in 5 two" gdb_test "print lines" " =3D 1042.*" "verify lines 5 two" =20 gdb_test "restart 6" "Switching to .*c =3D=3D 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 =3D=3D EOF.*" "step in 6 two" gdb_test "print lines" " =3D 1052.*" "verify lines 6 two" =20 gdb_test "restart 7" "Switching to .*c =3D=3D 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 =3D=3D EOF.*" "step in 7 two" gdb_test "print lines" " =3D 1162.*" "verify lines 7 two" diff --git a/gdb/testsuite/gdb.base/gdb-sigterm.exp b/gdb/testsuite/gdb.bas= e/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" ${testf= ile}.c]" \ temporary =20 - # gdb_continue_to_breakpoint would print a pass message. - gdb_test "continue" "Temporary breakpoint .* loop-line .*" "" + gdb_test "continue" "Temporary breakpoint .* loop-line .*" =20 - 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" =20 - 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}" =20 - 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 =20 for {set pass 0} {$pass < $passes} {incr pass} { - clean_restart ${testfile} - if { [do_test $pass] !=3D 0 } { - break + with_test_prefix "pass=3D$pass" { + clean_restart ${testfile} + if { [do_test $pass] !=3D 0 } { + break + } } } =20 diff --git a/gdb/testsuite/gdb.base/info-macros.exp b/gdb/testsuite/gdb.bas= e/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" =20 -gdb_test "next" ".*" "" +gdb_test "next" "" "next, 1" =20 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" =20 -gdb_test "next" ".*" "" +gdb_test "next" "" "next, 2" =20 -# 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" =20 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" =20 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" =20 -gdb_test "next" ".*" "" +gdb_test "next" "" "next, 6" set r1 "#define DEF_MACROS" set r2 "#define FOO\\(a\\) foo =3D 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 =20 gdb_breakpoint "pie_execl_marker" -gdb_test "info breakpoints" ".*" "" +gdb_test "info breakpoints" "" "info breakpoints first" =20 set addr1 "" set test "pie_execl_marker address first" @@ -101,7 +101,7 @@ gdb_test_multiple $test $test { } } =20 -gdb_test "info breakpoints" ".*" "" +gdb_test "info breakpoints" "" "info breakpoints second" =20 set addr2 "" set test "pie_execl_marker address second" diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/set= var.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 =3D=3D $final) || ([string first ".*" [lindex $args [expr $x= + 1]]] >=3D 0) } { set match [lindex $args [expr $x + 1]] - if { $count =3D=3D 1 } { - set mess "$message" - } else { - set mess "$message (#$count)" + set mess "$message -- $match" + if { $count !=3D 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/siz= eof.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] # =20 proc check_sizeof { type size } { - gdb_test "next" "" "" - gdb_test "p size" " =3D ${size}" "check sizeof \"$type\"" + with_test_prefix "check sizeof \"$type\"" { + gdb_test "next" + gdb_test "p size" " =3D ${size}" "size matches" + } } =20 check_sizeof "char" ${sizeof_char} @@ -80,8 +82,10 @@ check_sizeof "double" ${sizeof_double} check_sizeof "long double" ${sizeof_long_double} =20 proc check_valueof { exp val } { - gdb_test "next" "" "" - gdb_test "p /d value" " =3D ${val}" "check valueof \"$exp\"" + with_test_prefix "check valueof \"$exp\"" { + gdb_test "next" + gdb_test "p /d value" " =3D ${val}" "value matches" + } } =20 # 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/styl= e.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 =20 - eval "clean_restart $args" + with_test_prefix "$prefix" { + eval "clean_restart $args" =20 - if { $currently_disabled_style !=3D "" } { - 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 !=3D "" } { + 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" + } } } =20 @@ -73,7 +75,7 @@ proc run_style_tests { } { =20 # 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} =20 set readnow [readnow] =20 @@ -158,16 +160,15 @@ proc run_style_tests { } { set re_styled $re2_styled } =20 - gdb_test_no_output "set width $width" - gdb_test "frame" $re_styled "frame when width=3D$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=3D 0} {incr i -1} { - gdb_test "reverse-stepi" "" "" + gdb_test -nopass "reverse-stepi" set post_regs($i) [capture_command_output "info all-registers" ""] } =20 diff --git a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp b/gdb/test= suite/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 =20 gdb_test "break $endmain" \ - "Breakpoint.* file .*$srcfile, line $endmain.*" "" + "Breakpoint.* file .*$srcfile, line $endmain.*" \ + "break at end of main" =20 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 for= ward" { # =20 # 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" ".* =3D 0$newline" "module global reverse-breakp= oint" -gdb_test "step" ".* module global post-change .*" "" -gdb_test "print aglobal" ".* =3D 1$newline" "module global forward past b= p" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print aglobal" ".* =3D 0$newline" "module global reverse-step t= o 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 $breakl= oc" + + gdb_test "print aglobal" " =3D 0$newline" "module global reverse-brea= kpoint" + gdb_test "step" " module global post-change .*" + gdb_test "print aglobal" " =3D 1$newline" "module global forward past= bp" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print aglobal" " =3D 0$newline" "module global reverse-step= to bp" +} =20 # 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" ".* =3D 0$newline" "module static reverse-breakp= oint" -gdb_test "step" ".* module static post-change .*" "" -gdb_test "print astatic" ".* =3D 1$newline" "module static forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print astatic" ".* =3D 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 $breakl= oc" + + gdb_test "print astatic" " =3D 0$newline" "module static reverse-brea= kpoint" + gdb_test "step" " module static post-change .*" + gdb_test "print astatic" " =3D 1$newline" "module static forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print astatic" " =3D 0$newline" "module static reverse-step" +} =20 # 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" ".* =3D 0$newline" "function static reverse-break= point" -gdb_test "step" ".* function static post-change .*" "" -gdb_test "print a" ".* =3D 1$newline" "function static forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "function static reverse-bre= akpoint" + gdb_test "step" " function static post-change .*" + gdb_test "print a" " =3D 1$newline" "function static forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " =3D 0$newline" "function static reverse-ste= p" +} =20 # 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" ".* =3D 0$newline" "auto var reverse-breakpoint" -gdb_test "step" ".* auto post-change .*" "" -gdb_test "print a" ".* =3D 1$newline" "auto var forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "auto var reverse-breakpoint" + gdb_test "step" " auto post-change .*" + gdb_test "print a" " =3D 1$newline" "auto var forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " =3D 0$newline" "auto var reverse-step" +} =20 # 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" ".* =3D 0$newline" "register var reverse-breakpoi= nt" -gdb_test "step" ".* register post-change .*" "" -gdb_test "print a" ".* =3D 1$newline" \ - "register var step post-change, first time" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "register var reverse-breakp= oint" + gdb_test "step" " register post-change .*" + gdb_test "print a" " =3D 1$newline" \ + "register var step post-change, first time" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " =3D 0$newline" "register var reverse step-t= o" +} =20 # Proceed to beginning of main =20 -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" =20 # Now repeat tests while replaying forward. =20 # 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" ".* =3D 0$newline" "register var forward-breakpoi= nt" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 0$newline" "register var forward step-to" -gdb_test "step" ".* register post-change .*" "" -gdb_test "print a" ".* =3D 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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "register var forward-breakp= oint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " =3D 0$newline" "register var forward step-t= o" + gdb_test "step" " register post-change .*" "step, 2" + gdb_test "print a" " =3D 1$newline" \ + "register var step post-change, second time" +} =20 # 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" ".* =3D 0$newline" "auto var forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 0$newline" "auto var forward step-to" -gdb_test "step" ".* auto post-change .*" "" -gdb_test "print a" ".* =3D 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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "auto var forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " =3D 0$newline" "auto var forward step-to" + gdb_test "step" " auto post-change .*" "step, 2" + gdb_test "print a" " =3D 1$newline" "auto var step post-change" +} =20 # 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" ".* =3D 0$newline" "function static forward-break= point" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 0$newline" "function static forward step-= to" -gdb_test "step" ".* function static post-change .*" "" -gdb_test "print a" ".* =3D 1$newline" "function static step post-cha= nge" +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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "function static forward-bre= akpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " =3D 0$newline" "function static forward ste= p-to" + gdb_test "step" " function static post-change .*" "step, 2" + gdb_test "print a" " =3D 1$newline" "function static step post-c= hange" +} =20 # 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" ".* =3D 0$newline" "module static forward-breakp= oint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print astatic" ".* =3D 0$newline" "module static forward step-t= o" -gdb_test "step" ".* module static post-change .*" "" -gdb_test "print astatic" ".* =3D 1$newline" "module static step post-chan= ge" +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 $breakl= oc" + + gdb_test "print astatic" " =3D 0$newline" "module static forward-brea= kpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print astatic" " =3D 0$newline" "module static forward step= -to" + gdb_test "step" " module static post-change .*" "step, 2" + gdb_test "print astatic" " =3D 1$newline" "module static step post-ch= ange" +} =20 # 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" ".* =3D 0$newline" "module global forward-breakp= oint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print aglobal" ".* =3D 0$newline" "module global forward step-t= o" -gdb_test "step" ".* module global post-change .*" "" -gdb_test "print aglobal" ".* =3D 1$newline" "module global step post-chan= ge" +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 $breakl= oc" + + gdb_test "print aglobal" " =3D 0$newline" "module global forward-brea= kpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print aglobal" " =3D 0$newline" "module global forward step= -to" + gdb_test "step" " module global post-change .*" "step, 2" + gdb_test "print aglobal" " =3D 1$newline" "module global step post-ch= ange" +} =20 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 =20 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.*" =20 ### @@ -74,157 +75,166 @@ gdb_continue_to_breakpoint "end of main" ".*$srcfile:= $endmain.*" # =20 # 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" ".* =3D 0$newline" "module global reverse-breakp= oint" -gdb_test "step" ".* module global post-change .*" "" -gdb_test "print aglobal" ".* =3D 1$newline" "module global forward past b= p" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print aglobal" ".* =3D 0$newline" "module global reverse-step t= o 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 $breakl= oc" + + gdb_test "print aglobal" " =3D 0$newline" "module global reverse-brea= kpoint" + gdb_test "step" " module global post-change .*" + gdb_test "print aglobal" " =3D 1$newline" "module global forward past= bp" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print aglobal" " =3D 0$newline" "module global reverse-step= to bp" +} =20 # 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" ".* =3D 0$newline" "module static reverse-breakp= oint" -gdb_test "step" ".* module static post-change .*" "" -gdb_test "print astatic" ".* =3D 1$newline" "module static forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print astatic" ".* =3D 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 $breakl= oc" + + gdb_test "print astatic" " =3D 0$newline" "module static reverse-brea= kpoint" + gdb_test "step" " module static post-change .*" + gdb_test "print astatic" " =3D 1$newline" "module static forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print astatic" " =3D 0$newline" "module static reverse-step" +} =20 # 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" ".* =3D 0$newline" "function static reverse-break= point" -gdb_test "step" ".* function static post-change .*" "" -gdb_test "print a" ".* =3D 1$newline" "function static forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "function static reverse-bre= akpoint" + gdb_test "step" " function static post-change .*" + gdb_test "print a" " =3D 1$newline" "function static forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " =3D 0$newline" "function static reverse-ste= p" +} =20 # 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" ".* =3D 0$newline" "auto var reverse-breakpoint" -gdb_test "step" ".* auto post-change .*" "" -gdb_test "print a" ".* =3D 1$newline" "auto var forward" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "auto var reverse-breakpoint" + gdb_test "step" " auto post-change .*" + gdb_test "print a" " =3D 1$newline" "auto var forward" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " =3D 0$newline" "auto var reverse-step" +} =20 # 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" ".* =3D 0$newline" "register var reverse-breakpoi= nt" -gdb_test "step" ".* register post-change .*" "" -gdb_test "print a" ".* =3D 1$newline" "register var step post-change" -gdb_test "reverse-step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "register var reverse-breakp= oint" + gdb_test "step" " register post-change .*" + gdb_test "print a" " =3D 1$newline" "register var step post-chan= ge" + gdb_test "reverse-step" "$newline$breakloc.*" + gdb_test "print a" " =3D 0$newline" \ + "register var reverse step-to, first time" +} =20 # Proceed to beginning of main =20 -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" =20 # Now repeat tests while replaying forward. =20 # Register variable, forward =20 -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] =20 -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 $breakl= oc" =20 -gdb_test "print a" ".* =3D 0$newline" "register var forward-breakpoi= nt" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 0$newline" "register var forward step-to" -gdb_test "step" ".* register post-change .*" "" -gdb_test "print a" ".* =3D 1$newline" \ - "register var step post-change, second time" + gdb_test "print a" " =3D 0$newline" "register var forward-breakp= oint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " =3D 0$newline" "register var forward step-t= o" + gdb_test "step" " register post-change .*" "step, 2" + gdb_test "print a" " =3D 1$newline" \ + "register var step post-change, second time" +} =20 # 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" ".* =3D 0$newline" "auto var forward-breakpoint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 0$newline" "auto var forward step-to" -gdb_test "step" ".* auto post-change .*" "" -gdb_test "print a" ".* =3D 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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "auto var forward-breakpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " =3D 0$newline" "auto var forward step-to" + gdb_test "step" " auto post-change .*" "step, 2" + gdb_test "print a" " =3D 1$newline" "auto var step post-change" +} =20 # 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" ".* =3D 0$newline" "function static forward-break= point" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print a" ".* =3D 0$newline" "function static forward step-= to" -gdb_test "step" ".* function static post-change .*" "" -gdb_test "print a" ".* =3D 1$newline" "function static step post-cha= nge" +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 $breakl= oc" + + gdb_test "print a" " =3D 0$newline" "function static forward-bre= akpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print a" " =3D 0$newline" "function static forward ste= p-to" + gdb_test "step" " function static post-change .*" "step, 2" + gdb_test "print a" " =3D 1$newline" "function static step post-c= hange" +} =20 # 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" ".* =3D 0$newline" "module static forward-breakp= oint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print astatic" ".* =3D 0$newline" "module static forward step-t= o" -gdb_test "step" ".* module static post-change .*" "" -gdb_test "print astatic" ".* =3D 1$newline" "module static step post-chan= ge" +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 $breakl= oc" + + gdb_test "print astatic" " =3D 0$newline" "module static forward-brea= kpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print astatic" " =3D 0$newline" "module static forward step= -to" + gdb_test "step" " module static post-change .*" "step, 2" + gdb_test "print astatic" " =3D 1$newline" "module static step post-ch= ange" +} =20 # 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" ".* =3D 0$newline" "module global forward-breakp= oint" -gdb_test "reverse-step" ".*hide.*" "" -gdb_test "step" ".*$newline$breakloc.*" "" -gdb_test "print aglobal" ".* =3D 0$newline" "module global forward step-t= o" -gdb_test "step" ".* module global post-change .*" "" -gdb_test "print aglobal" ".* =3D 1$newline" "module global step post-chan= ge" - +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 $breakl= oc" + + gdb_test "print aglobal" " =3D 0$newline" "module global forward-brea= kpoint" + gdb_test "reverse-step" "hide.*" + gdb_test "step" "$newline$breakloc.*" "step, 1" + gdb_test "print aglobal" " =3D 0$newline" "module global forward step= -to" + gdb_test "step" " module global post-change .*" "step, 2" + gdb_test "print aglobal" " =3D 1$newline" "module global step post-ch= ange" +} 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=3D$inf, iter=3D$it= er)" { - -wrap -re $pattern { - } - }] !=3D 0} { + if {[gdb_test -nopass \ + $cmd $pattern "access mem ($message, inf=3D$inf, iter=3D$iter)"] \ + !=3D 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" =20 if {$inf =3D=3D 1} { set inf 2 diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsui= te/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 } =20 - gdb_test "detach" "Detaching from.*" "" + gdb_test -nopass "detach" "Detaching from.*" } =20 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 =3D=3D 1 && $now =3D=3D 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 .*"] !=3D 0} { +if {[gdb_test "" "Breakpoint .*" "run to main"] !=3D 0} { return -1 } =20 diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trac= e/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 tra= ce frame" "none" "-1" =20 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 =3D=3D 1, collect nothing" =20 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 =3D=3D 1, collect regs" =20 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 =3D=3D 1, collect args and loca= ls" =20 =20 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 =3D=3D 1, collect stack mem exp= r" "0" 4 =20 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 =3D=3D 2, collect nothing" =20 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 =3D=3D 2, collect regs" =20 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 =3D=3D 2, collect args and loca= ls" =20 =20 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 =3D=3D 1, collect stack mem exp= r" "0" 9 =20 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 =3D=3D 3, collect nothing" =20 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 =3D=3D 3, collect regs" =20 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 =3D=3D 3, collect args and loca= ls" =20 =20 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 =3D=3D 1, collect stack mem exp= r" "0" 14 =20 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 =3D=3D 4, collect nothing" =20 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 =3D=3D 4, collect regs" =20 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 =3D=3D 4, collect args and loca= ls" =20 =20 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 =3D=3D 1, collect stack mem exp= r" "0" 19 =20 gdb_test "printf \"x \%d x\\n\", depth =3D=3D 3" \ @@ -350,4 +350,4 @@ gdb_test "printf \"x \%d x\\n\", depth =3D=3D 3" \ "1.13: trace in recursion: depth not equal to 3" =20 # Finished! -gdb_test "tfind none" ".*" "" +gdb_test "tfind none" ".*" diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.tra= ce/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 } =20 -proc run_trace_experiment { msg test_func } { +proc run_trace_experiment { test_func } { global gdb_prompt =20 - 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" =20 - 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" =20 - 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" + } } =20 =20 @@ -102,128 +99,136 @@ proc gdb_collect_args_test { myargs msg } { global cr global gdb_prompt =20 - prepare_for_trace_test + with_test_prefix "collect $msg" { + prepare_for_trace_test =20 - 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" "^$" =20 - # Begin the test. - run_trace_experiment $msg args_test_func + # Begin the test. + run_trace_experiment args_test_func =20 - # 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. =20 - gdb_test "tfind -1" ".*" "" - gdb_test_no_output "set print entry-values only" "" - gdb_test "tfind 0" \ - " \\(argc@entry=3D\[^,\]*, argi@entry=3D\[^,\]*, argf@entry=3D\[^,\]*, ar= gd@entry=3D\[^,\]*, argstruct@entry=3D\[^,\]*, argarray@entry=3D\[^,\]*\\) = .*" \ - "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=3D\[^,\]*, argi@entry=3D\[^,\]*, argf@entry=3D\[^,\]*, a= rgd@entry=3D\[^,\]*, argstruct@entry=3D\[^,\]*, argarray@entry=3D\[^,\]*\\)= .*" \ + "tfind 0 with entry-values only" + } =20 - gdb_test "tfind -1" ".*" "" - gdb_test_no_output "set print entry-values both" "" - gdb_test "tfind 0" \ - " \\(argc=3D\[^,\]*, argc@entry=3D\[^,\]*, argi=3D\[^,\]*, argi@entry=3D\= [^,\]*, argf=3D\[^,\]*, argf@entry=3D\[^,\]*, argd=3D\[^,\]*, argd@entry=3D= \[^,\]*, argstruct=3D\[^,\]*, argstruct@entry=3D\[^,\]*, argarray=3D\[^,\]*= , argarray@entry=3D\[^,\]*\\) .*" \ - "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=3D\[^,\]*, argc@entry=3D\[^,\]*, argi=3D\[^,\]*, argi@entry=3D= \[^,\]*, argf=3D\[^,\]*, argf@entry=3D\[^,\]*, argd=3D\[^,\]*, argd@entry= =3D\[^,\]*, argstruct=3D\[^,\]*, argstruct@entry=3D\[^,\]*, argarray=3D\[^,= \]*, argarray@entry=3D\[^,\]*\\) .*" \ + "tfind 0 with entry-values both" + } =20 - gdb_test "print argc" \ + gdb_test "print argc" \ "\\$\[0-9\]+ =3D 1 '.001'$cr" \ - "collect $msg: collected arg char" - gdb_test "print argi" \ + "collected arg char" + gdb_test "print argi" \ "\\$\[0-9\]+ =3D 2$cr" \ - "collect $msg: collected arg int" - gdb_test "print argf" \ + "collected arg int" + gdb_test "print argf" \ "\\$\[0-9\]+ =3D 3.\[23\]\[0-9\]*$cr" \ - "collect $msg: collected arg float" - gdb_test "print argd" \ + "collected arg float" + gdb_test "print argd" \ "\\$\[0-9\]+ =3D 4.\[34\]\[0-9\]*$cr" \ - "collect $msg: collected arg double" + "collected arg double" =20 - # 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\]+ =3D 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\]+ =3D 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\]+ =3D 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\]+ =3D 104.\[34\]\[0-9\]*$cr" \ - "collect $msg: collected arg struct member double" + "collected arg struct member double" =20 - # array arg as one of several args (near end of list) + # array arg as one of several args (near end of list) =20 - # 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. =20 - setup_xfail "*-*-*" - gdb_test "print argarray\[0\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[0\]" \ "\\$\[0-9\]+ =3D 111$cr" \ - "collect $msg: collected argarray #0" + "collected argarray #0" =20 - setup_xfail "*-*-*" - gdb_test "print argarray\[1\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[1\]" \ "\\$\[0-9\]+ =3D 112$cr" \ - "collect $msg: collected argarray #1" + "collected argarray #1" =20 - setup_xfail "*-*-*" - gdb_test "print argarray\[2\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[2\]" \ "\\$\[0-9\]+ =3D 113$cr" \ - "collect $msg: collected argarray #2" + "collected argarray #2" =20 - setup_xfail "*-*-*" - gdb_test "print argarray\[3\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[3\]" \ "\\$\[0-9\]+ =3D 114$cr" \ - "collect $msg: collected argarray #3" + "collected argarray #3" =20 - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } =20 proc gdb_collect_argstruct_test { myargs msg } { global cr global gdb_prompt =20 - prepare_for_trace_test + with_test_prefix "collect $msg" { + prepare_for_trace_test =20 - 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" "^$" =20 - # Begin the test. - run_trace_experiment $msg argstruct_test_func + # Begin the test. + run_trace_experiment argstruct_test_func =20 - # struct argument as only argument - gdb_test "print argstruct.memberc" \ + # struct argument as only argument + gdb_test "print argstruct.memberc" \ "\\$\[0-9\]+ =3D 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\]+ =3D 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\]+ =3D 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\]+ =3D 104.\[34\]\[0-9\]*$cr" \ - "collect $msg: collected arg struct member double" + "collected arg struct member double" =20 - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } =20 =20 @@ -231,50 +236,53 @@ proc gdb_collect_argarray_test { myargs msg } { global cr global gdb_prompt =20 - prepare_for_trace_test + with_test_prefix "collect $msg" { =20 - 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" "^$" =20 - # Begin the test. - run_trace_experiment $msg argarray_test_func + # Begin the test. + run_trace_experiment argarray_test_func =20 - # array arg as only argument + # array arg as only argument =20 - # 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. =20 - setup_xfail "*-*-*" - gdb_test "print argarray\[0\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[0\]" \ "\\$\[0-9\]+ =3D 111$cr" \ - "collect $msg: collected argarray #0" + "collected argarray #0" =20 - setup_xfail "*-*-*" - gdb_test "print argarray\[1\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[1\]" \ "\\$\[0-9\]+ =3D 112$cr" \ - "collect $msg: collected argarray #1" + "collected argarray #1" =20 - setup_xfail "*-*-*" - gdb_test "print argarray\[2\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[2\]" \ "\\$\[0-9\]+ =3D 113$cr" \ - "collect $msg: collected argarray #2" + "collected argarray #2" =20 - setup_xfail "*-*-*" - gdb_test "print argarray\[3\]" \ + setup_xfail "*-*-*" + gdb_test "print argarray\[3\]" \ "\\$\[0-9\]+ =3D 114$cr" \ - "collect $msg: collected argarray #3" + "collected argarray #3" =20 - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } =20 =20 @@ -282,78 +290,79 @@ proc gdb_collect_locals_test { func mylocs msg } { global cr global gdb_prompt =20 - 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 lin= e" { - -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 - } - } =20 - 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" "^$" =20 - # Begin the test. - run_trace_experiment $msg $func + # Begin the test. + run_trace_experiment $func =20 - gdb_test "print locc" \ - "\\$\[0-9\]+ =3D 11 '.\[a-z0-7\]+'$cr" \ - "collect $msg: collected local char" - gdb_test "print loci" \ + gdb_test "print locc" \ + "\\$\[0-9\]+ =3D 11 '.\[a-z0-7\]+'$cr" \ + "collected local char" + gdb_test "print loci" \ "\\$\[0-9\]+ =3D 12$cr" \ - "collect $msg: collected local int" - gdb_test "print locf" \ + "collected local int" + gdb_test "print locf" \ "\\$\[0-9\]+ =3D 13.\[23\]\[0-9\]*$cr" \ - "collect $msg: collected local float" - gdb_test "print locd" \ + "collected local float" + gdb_test "print locd" \ "\\$\[0-9\]+ =3D 14.\[34\]\[0-9\]*$cr" \ - "collect $msg: collected local double" + "collected local double" =20 - gdb_test "print locst.memberc" \ + gdb_test "print locst.memberc" \ "\\$\[0-9\]+ =3D 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\]+ =3D 16$cr" \ - "collect $msg: collected local member int" - gdb_test "print locst.memberf" \ + "collected local member int" + gdb_test "print locst.memberf" \ "\\$\[0-9\]+ =3D 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\]+ =3D 18.\[78\]\[0-9\]*$cr" \ - "collect $msg: collected local member double" + "collected local member double" =20 - gdb_test "print locar\[0\]" \ + gdb_test "print locar\[0\]" \ "\\$\[0-9\]+ =3D 121$cr" \ - "collect $msg: collected locarray #0" - gdb_test "print locar\[1\]" \ + "collected locarray #0" + gdb_test "print locar\[1\]" \ "\\$\[0-9\]+ =3D 122$cr" \ - "collect $msg: collected locarray #1" - gdb_test "print locar\[2\]" \ + "collected locarray #1" + gdb_test "print locar\[2\]" \ "\\$\[0-9\]+ =3D 123$cr" \ - "collect $msg: collected locarray #2" - gdb_test "print locar\[3\]" \ + "collected locarray #2" + gdb_test "print locar\[3\]" \ "\\$\[0-9\]+ =3D 124$cr" \ - "collect $msg: collected locarray #3" - =20 + "collected locarray #3" =20 - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } =20 proc gdb_collect_registers_test { myregs } { @@ -363,26 +372,28 @@ proc gdb_collect_registers_test { myregs } { global spreg global pcreg =20 - prepare_for_trace_test + with_test_prefix "collect $myregs" { + prepare_for_trace_test =20 - # 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" "^$" =20 - # Begin the test. - run_trace_experiment $myregs args_test_func + # Begin the test. + run_trace_experiment args_test_func =20 - test_register "\$$fpreg" $myregs - test_register "\$$spreg" $myregs - test_register "\$$pcreg" $myregs + test_register "\$$fpreg" $myregs + test_register "\$$spreg" $myregs + test_register "\$$pcreg" $myregs =20 - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $myregs: cease trace debugging" + "cease trace debugging" + } } =20 proc gdb_collect_expression_test { func expr val msg } { @@ -391,83 +402,86 @@ proc gdb_collect_expression_test { func expr val msg = } { =20 prepare_for_trace_test =20 - # Find the comment-identified line for setting this tracepoint. - set testline 0 - gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint lin= e" { - -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 - } - } =20 - 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" "^$" =20 - # Begin the test. - run_trace_experiment $msg $func + # Begin the test. + run_trace_experiment $func =20 - gdb_test "print $expr" \ + gdb_test "print $expr" \ "\\$\[0-9\]+ =3D $val$cr" \ - "collect $msg: got expected value '$val'" + "got expected value '$val'" =20 - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } =20 proc gdb_collect_globals_test { } { global cr global gdb_prompt =20 - 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 - } - } =20 - # 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 " =3D (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 " =3D (0x\[0-9a-f\]+)\r\n$gdb_prompt $" { + set globalarr2_addr $expect_out(1,string) + pass $test + } } - } =20 - 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" "^$" =20 - # Begin the test. - run_trace_experiment "globals" globals_test_func + # Begin the test. + run_trace_experiment globals_test_func =20 - gdb_test "print globalc" \ + gdb_test "print globalc" \ "\\$\[0-9\]+ =3D 71 'G'$cr" \ - "collect globals: collected global char" - gdb_test "print globali" \ + "collected global char" + gdb_test "print globali" \ "\\$\[0-9\]+ =3D 72$cr" \ - "collect globals: collected global int" - gdb_test "print globalf" \ + "collected global int" + gdb_test "print globalf" \ "\\$\[0-9\]+ =3D 73.\[23\]\[0-9\]*$cr" \ - "collect globals: collected global float" - gdb_test "print globald" \ + "collected global float" + gdb_test "print globald" \ "\\$\[0-9\]+ =3D 74.\[34\]\[0-9\]*$cr" \ - "collect globals: collected global double" + "collected global double" =20 - gdb_test "print globalstruct.memberc" \ + gdb_test "print globalstruct.memberc" \ "\\$\[0-9\]+ =3D 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\]+ =3D 82$cr" \ - "collect globals: collected struct member int" - gdb_test "print globalstruct.memberf" \ + "collected struct member int" + gdb_test "print globalstruct.memberf" \ "\\$\[0-9\]+ =3D 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\]+ =3D 84.\[34\]\[0-9\]*$cr" \ - "collect globals: collected struct member double" + "collected struct member double" =20 - gdb_test "print globalp =3D=3D &globalstruct" \ + gdb_test "print globalp =3D=3D &globalstruct" \ "\\$\[0-9\]+ =3D 1$cr" \ - "collect globals: collected global pointer" + "collected global pointer" =20 - gdb_test "print globalarr\[1\]" \ + gdb_test "print globalarr\[1\]" \ "\\$\[0-9\]+ =3D 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\]+ =3D 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\]+ =3D 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\]+ =3D \\{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\]+ =3D \\{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\]+ =3D \\{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\]+ =3D \\{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" + } } =20 # 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 =20 - prepare_for_trace_test + with_test_prefix "collect global in pieces" { + prepare_for_trace_test =20 - # 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 + } } - } =20 - if {$testline =3D=3D 0} { - return - } + if {$testline =3D=3D 0} { + return + } =20 - 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" \ "^$" =20 - # Begin the test. - run_trace_experiment "global in pieces" globals_test_func + # Begin the test. + run_trace_experiment globals_test_func =20 - gdb_test "print /x global_pieces.a" " =3D 0x12345678" \ - "collect global in pieces: print piece a" - gdb_test "print /x global_pieces.b" " =3D 0x87654321" \ - "collect global in pieces: print piece b" + gdb_test "print /x global_pieces.a" " =3D 0x12345678" \ + "print piece a" + gdb_test "print /x global_pieces.b" " =3D 0x87654321" \ + "print piece b" =20 - gdb_test "print /x global_pieces" " =3D \{a =3D 0x12345678, b =3D 0x87= 654321\}" \ - "collect global in pieces: print whole object" + gdb_test "print /x global_pieces" " =3D \{a =3D 0x12345678, b =3D 0x87654= 321\}" \ + "print whole object" =20 - gdb_test "tfind none" "#0 end .*" \ - "collect global in pieces: cease trace debugging" + gdb_test "tfind none" "#0 end .*" \ + "cease trace debugging" + } } =20 proc gdb_collect_return_test { } { global gdb_prompt =20 - prepare_for_trace_test + with_test_prefix "collect \$_ret" { + prepare_for_trace_test =20 - # 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" "^$" =20 - # 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)" + } } - } =20 - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect \$_ret: cease trace debugging" + "cease trace debugging" + } } =20 proc gdb_collect_strings_test { func mystr myrslt mylim msg } { @@ -618,42 +636,44 @@ proc gdb_collect_strings_test { func mystr myrslt myl= im msg } { global cr global gdb_prompt =20 - 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 lin= e" { - -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 - } - } =20 - 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" "^$" =20 - # Begin the test. - run_trace_experiment $msg $func + # Begin the test. + run_trace_experiment $func =20 - gdb_test "print $mystr" \ - "\\$\[0-9\]+ =3D $hex \"$myrslt\".*$cr" \ - "collect $msg: collected local string" + gdb_test "print $mystr" \ + "\\$\[0-9\]+ =3D $hex \"$myrslt\".*$cr" \ + "collected local string" =20 - gdb_test "tfind none" \ + gdb_test "tfind none" \ "#0 end .*" \ - "collect $msg: cease trace debugging" + "cease trace debugging" + } } =20 proc gdb_trace_collection_test {} { @@ -785,4 +805,4 @@ if { ![gdb_target_supports_trace] } then { gdb_trace_collection_test =20 # Finished! -gdb_test "tfind none" ".*" "" +gdb_test "tfind none" ".*" diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trac= e/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.*"] !=3D 0} { +if {[gdb_test "" "Breakpoint ${decimal}, main.*" "run to main"] !=3D 0} { return -1 } =20 diff --git a/gdb/testsuite/gdb.trace/passc-dyn.exp b/gdb/testsuite/gdb.trac= e/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 =20 @@ -96,40 +94,40 @@ gdb_test "continue" \ "run trace experiment" gdb_test "tstop" ".*" "" =20 -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" } =20 -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" } =20 -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" } =20 -gdb_test "tfind tracepoint $tdp4" ".*" "" -if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 2 x" ""] { [...] [diff truncated at 100000 bytes]