From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 2A2A93858D28; Mon, 18 Apr 2022 14:28:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A2A93858D28 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: make gdb.ada/mi_prot.exp stop at expected location X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 2bb8c72b39f4dcce0be292b2c701edbe4dd4ca7c X-Git-Newrev: c67f4e53895da91ce7f2eff3544e9de02280f740 Message-Id: <20220418142844.2A2A93858D28@sourceware.org> Date: Mon, 18 Apr 2022 14:28:44 +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: Mon, 18 Apr 2022 14:28:44 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc67f4e53895d= a91ce7f2eff3544e9de02280f740 commit c67f4e53895da91ce7f2eff3544e9de02280f740 Author: Simon Marchi Date: Thu Apr 14 12:26:33 2022 -0400 gdb/testsuite: make gdb.ada/mi_prot.exp stop at expected location =20 This test attempts to run until the line marked "STOP", which is at prot.adb:34. It first runs until the "main" symbol, then tries to place a breakpoint by line at line 34, without specifying the source file. W= hen looking at the logs: =20 -break-insert -t 34^M ^done,bkpt=3D{number=3D"2",type=3D"breakpoint",disp=3D"del",enabled= =3D"y",addr=3D"0x0000555555558a6c",func=3D"adafinal",file=3D"/home/simark/b= uild/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.ada/mi_pro t/b~pr= ot.adb",fullname=3D"/home/simark/build/binutils-gdb-one-target/gdb/testsuit= e/outputs/gdb.ada/mi_prot/b~prot.adb",line=3D"44",thread-groups=3D["i1"],ti= mes=3D"0",original-location=3D"/home/simark/b uild/binutils-gdb-one-targ= et/gdb/testsuite/outputs/gdb.ada/mi_prot/b~prot.adb:34"}^M ... continues ... *stopped,reason=3D"breakpoint-hit",disp=3D"del",bkptno=3D"2",frame= =3D{addr=3D"0x0000555555558a6c",func=3D"adafinal",args=3D[],file=3D"/home/s= imark/build/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.ada/ mi_pr= ot/b~prot.adb",fullname=3D"/home/simark/build/binutils-gdb-one-target/gdb/t= estsuite/outputs/gdb.ada/mi_prot/b~prot.adb",line=3D"44",arch=3D"i386:x86-6= 4"},thread-id=3D"1",stopped-threads=3D"all",co re=3D"8"^M =20 ... we see that the breakpoint is placed in some generated file, not in the test source file as we expect. The problem is that "b main" in Ada does not place a breakpoint on the "Ada main", but on some symbol in a generated source file. So when stopped at the "main" symbol, we are not stopped in the file that contains the STOP marker at line 34. =20 The test passes anyway today, so it doesn't seem to matter that we are stopped at an unexpected location. But it starts failing with this patch [1], because b~prot.adb:34 happens to be between two functions, so the breakpoint doesn't resolve. =20 Fix this by placing the breakpoint at "$srcfile:$line", which works regardless of what is the current source file. =20 However, this ends up introducing a path in the test name. Modify mi_tbreak and mi_continue_to_line to avoid that. =20 [1] https://sourceware.org/pipermail/gdb-patches/2022-April/187686.html =20 Change-Id: I742e2a9993046dcb5e30c64fe2ad920a363baf75 Diff: --- gdb/testsuite/gdb.ada/mi_prot.exp | 2 +- gdb/testsuite/lib/mi-support.exp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/gdb.ada/mi_prot.exp b/gdb/testsuite/gdb.ada/mi_p= rot.exp index b68dcb532b4..5ec7f8ddc6d 100644 --- a/gdb/testsuite/gdb.ada/mi_prot.exp +++ b/gdb/testsuite/gdb.ada/mi_prot.exp @@ -41,7 +41,7 @@ mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} =20 set line [gdb_get_line_number "STOP" ${testdir}/prot.adb] -mi_continue_to_line $line "continue to protected method" +mi_continue_to_line "$srcfile:$line" "continue to protected method" =20 # The bug was that this crashed. mi_gdb_test "-stack-list-arguments --no-frame-filters 1" \ diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-suppor= t.exp index 857a04519cf..701c53f1321 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1802,13 +1802,13 @@ proc mi_get_inline_test {testcase} { } =20 # Sets temporary breakpoint at LOCATION. -proc mi_tbreak {location} { +proc mi_tbreak {location test} { =20 global mi_gdb_prompt =20 mi_gdb_test "-break-insert -t $location" \ {\^done,bkpt=3D.*} \ - "run to $location (set breakpoint)" + $test } =20 # Send COMMAND that must be a command that resumes @@ -1864,10 +1864,10 @@ proc mi_send_resuming_command {command test} { # be determined. # Does not check that the line is the same as requested. # The caller can check itself if required. -proc mi_continue_to_line {location test} { +proc_with_prefix mi_continue_to_line {location test} { =20 - mi_tbreak $location - mi_send_resuming_command "exec-continue" "run to $location (exec-conti= nue)" + mi_tbreak $location "set temporary breakpoint" + mi_send_resuming_command "exec-continue" "continue to breakpoint" return [mi_get_stop_line $test] } =20 @@ -1954,7 +1954,7 @@ proc mi_run_inline_test { testcase } { =20 if {$first=3D=3D1} { # Start the program afresh. - mi_tbreak "$mi_autotest_source:$line" + mi_tbreak "$mi_autotest_source:$line" "set temporary breakpoint" if { [mi_run_cmd] < 0 } { return -1 }