From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id D23A23858D37; Thu, 21 Apr 2022 19:05:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D23A23858D37 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: fix "set temporary breakpoint" DUPLICATEs X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 31de881f8f9a03499002d28ff42286b79c24a97d X-Git-Newrev: 0b84fbd54ee44cc88fd95cf1993f0e704c4d78e2 Message-Id: <20220421190538.D23A23858D37@sourceware.org> Date: Thu, 21 Apr 2022 19:05:38 +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: Thu, 21 Apr 2022 19:05:38 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D0b84fbd54ee4= 4cc88fd95cf1993f0e704c4d78e2 commit 0b84fbd54ee44cc88fd95cf1993f0e704c4d78e2 Author: Simon Marchi Date: Thu Apr 21 15:05:32 2022 -0400 gdb/testsuite: fix "set temporary breakpoint" DUPLICATEs =20 Commit c67f4e538 ("gdb/testsuite: make gdb.ada/mi_prot.exp stop at expected location") introduced some DUPLICATEs in MI tests using mi_continue_to_line, for example: =20 DUPLICATE: gdb.ada/mi_ref_changeable.exp: mi_continue_to_line: set = temporary breakpoint =20 These test names were previously differentiated by the location passed to mi_continue_to_line. Since the location can contain a path, that commit removed the location from the test name, in favor of a hardcoded string "set temporary breakpoint", hence removing the differentiator. =20 mi_continue_to_line receives a "test" parameter, containing a test name. Add a "with_test_prefix" with that name, so that all tests recorded during mi_continue_to_line have this in their name. =20 mi_continue_to_line passes that "test" string to mi_get_stop_line, that is a bit superfluous. mi_get_stop_line only uses that string in case of failures (it doesn't record a pass if everything goes fine). Since it's not crucial, just remove it, and adjust all callers. =20 Adjust three gdb.mi/mi-var-*.exp tests to use prefixes to differentiate the multiple calls to mi_run_inline_test (which calls mi_continue_to_line). =20 Change-Id: I511c6caa70499f8657b1cde37d71068d74d56a74 Diff: --- gdb/testsuite/gdb.mi/mi-var-cmd.exp | 2 +- gdb/testsuite/gdb.mi/mi-var-cp.exp | 2 +- gdb/testsuite/gdb.mi/mi-var-rtti.exp | 2 +- gdb/testsuite/gdb.python/py-framefilter-mi.exp | 4 ++-- gdb/testsuite/gdb.python/py-mi.exp | 4 ++-- gdb/testsuite/lib/mi-support.exp | 19 ++++++++++--------- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-= var-cmd.exp index a33b0c42e30..6c89c798ef1 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -596,7 +596,7 @@ set inline_tests { # Needs to be last, following tests rely on this. lappend inline_tests floating =20 -foreach inline_test $inline_tests { +foreach_with_prefix inline_test $inline_tests { if { [mi_run_inline_test $inline_test] < 0 } { return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-var-cp.exp b/gdb/testsuite/gdb.mi/mi-v= ar-cp.exp index 38c5eb2dcb5..ba366daf2c3 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cp.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cp.exp @@ -46,7 +46,7 @@ set inline_tests { path_expression } =20 -foreach inline_test $inline_tests { +foreach_with_prefix inline_test $inline_tests { if { [mi_run_inline_test $inline_test] < 0 } { return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.exp b/gdb/testsuite/gdb.mi/mi= -var-rtti.exp index 84b1a42bff2..0015d23a4be 100644 --- a/gdb/testsuite/gdb.mi/mi-var-rtti.exp +++ b/gdb/testsuite/gdb.mi/mi-var-rtti.exp @@ -119,7 +119,7 @@ set inline_tests { skip_type_update_when_not_use_rtti } =20 -foreach inline_test $inline_tests { +foreach_with_prefix inline_test $inline_tests { if { [mi_run_inline_test $inline_test] < 0 } { return -1 } diff --git a/gdb/testsuite/gdb.python/py-framefilter-mi.exp b/gdb/testsuite= /gdb.python/py-framefilter-mi.exp index 39431a301e1..08f9e17e9f9 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-mi.exp +++ b/gdb/testsuite/gdb.python/py-framefilter-mi.exp @@ -50,7 +50,7 @@ mi_gdb_test "source ${remote_python_file}" ".*\\^done." "= load python file" =20 # Multiple blocks test mi_continue_to_line [gdb_get_line_number {Inner test breakpoint} ${srcfile= }] \ - "step to breakpoint" + "step to first breakpoint" =20 mi_gdb_test "-stack-list-locals --all-values" \ "\\^done,locals=3D\\\[{name=3D\"h\",value=3D\"9\"},{name=3D\"f\",value= =3D\"42\"},{name=3D\"g\",value=3D\"19\"},{name=3D\"bar\",value=3D\"$hex \\\= \\"Inside block x2\\\\\"\"},{name=3D\"d\",value=3D\"15\"},{name=3D\"e\",val= ue=3D\"14\"},{name=3D\"foo\",value=3D\"$hex \\\\\"Inside block\\\\\"\"},{na= me=3D\"str\",value=3D\"$hex \\\\\"The End\\\\\"\"},{name=3D\"st2\",value=3D= \"$hex \\\\\"Is Near\\\\\"\"},{name=3D\"b\",value=3D\"12\"},{name=3D\"c\",v= alue=3D\"5\"}\\\]" \ @@ -62,7 +62,7 @@ mi_gdb_test "-stack-list-locals --all-values" \ "stack-list-locals --all-values frame filters enabled" =20 mi_continue_to_line [gdb_get_line_number {Backtrace end breakpoint} ${srcf= ile}] \ - "step to breakpoint" + "step to second breakpoint" =20 set any "\[^\"\]+" =20 diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/= py-mi.exp index 3704ce3b3d6..b832b2ccbd3 100644 --- a/gdb/testsuite/gdb.python/py-mi.exp +++ b/gdb/testsuite/gdb.python/py-mi.exp @@ -231,7 +231,7 @@ mi_varobj_update_dynamic container2 \ =20 mi_continue_to_line \ [gdb_get_line_number {MI outer breakpoint here} ${srcfile}] \ - "step to outer breakpoint" + "step to first outer breakpoint" =20 mi_create_dynamic_varobj outer outer 1 \ "create outer varobj" @@ -261,7 +261,7 @@ mi_varobj_update_with_type_change container int 0 "upda= te after type change" =20 mi_continue_to_line \ [gdb_get_line_number {break to inspect struct and union} ${srcfile}] \ - "step to outer breakpoint" + "step to second outer breakpoint" =20 with_test_prefix "varobj nscont" { mi_create_dynamic_varobj nscont nstype 1 \ diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-suppor= t.exp index 701c53f1321..a231b8311b9 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1865,14 +1865,15 @@ proc mi_send_resuming_command {command test} { # Does not check that the line is the same as requested. # The caller can check itself if required. proc_with_prefix mi_continue_to_line {location test} { - - mi_tbreak $location "set temporary breakpoint" - mi_send_resuming_command "exec-continue" "continue to breakpoint" - return [mi_get_stop_line $test] + with_test_prefix $test { + mi_tbreak $location "set temporary breakpoint" + mi_send_resuming_command "exec-continue" "continue to breakpoint" + return [mi_get_stop_line] + } } =20 # Wait until gdb prints the current line. -proc mi_get_stop_line {test} { +proc mi_get_stop_line {} { =20 global mi_gdb_prompt global async @@ -1888,10 +1889,10 @@ proc mi_get_stop_line {test} { return $expect_out(1,string) } -re ".*$mi_gdb_prompt" { - fail "wait for stop ($test)" + fail "wait for stop (unexpected output)" } timeout { - fail "wait for stop ($test)" + fail "wait for stop (timeout)" } } } @@ -1958,7 +1959,7 @@ proc mi_run_inline_test { testcase } { if { [mi_run_cmd] < 0 } { return -1 } - set line_now [mi_get_stop_line "$testcase: step to $line"] + set line_now [mi_get_stop_line] set first 0 } elseif {$line_now!=3D$line} { set line_now [mi_continue_to_line "$mi_autotest_source:$line" "contin= ue to $line"] @@ -1976,7 +1977,7 @@ proc mi_run_inline_test { testcase } { if { [mi_send_resuming_command "exec-next" "$testcase: step over $line"] = !=3D 0 } { return -1 } - set line_now [mi_get_stop_line "$testcase: step over $line"] + set line_now [mi_get_stop_line] =20 # We probably want to use 'uplevel' so that statements # have direct access to global variables that the