From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 409D13858D33; Wed, 1 Feb 2023 17:35:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 409D13858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675272918; bh=AXIEztEfZvwJwSTggH+/sWYsWR9abkJLIFgOIBNcSvU=; h=From:To:Subject:Date:From; b=Y47rak+qpdQ6fTFwjaC1GQPZNhCciFJVHSzIGHDk+xdd1TK71MyfJbqCfR5g4/IuU hrRVi1lYCF7IUYJivZmKM789AVNwluVHH0LV4sApgk7bCbzRuNSusx39vc35IaeTtt BAkbffPQmeBBNjYbBIb1Uc0kL5gTwCeN1rrjeP4w= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: fix fetch_src_and_symbols.exp with native-gdbserver board X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 6647f05df023b63bbe056e9167e9e234172fa2ca X-Git-Newrev: cded17bfca35566fa4d36e9ec06fa071bd7dab17 Message-Id: <20230201173518.409D13858D33@sourceware.org> Date: Wed, 1 Feb 2023 17:35:18 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dcded17bfca35= 566fa4d36e9ec06fa071bd7dab17 commit cded17bfca35566fa4d36e9ec06fa071bd7dab17 Author: Andrew Burgess Date: Wed Feb 1 17:09:47 2023 +0000 gdb/testsuite: fix fetch_src_and_symbols.exp with native-gdbserver board =20 I noticed that the gdb.debuginfod/fetch_src_and_symbols.exp script doesn't work with the native-gdbserver board, I see this error: =20 ERROR: tcl error sourcing /tmp/build/gdb/testsuite/../../../src/gdb/t= estsuite/gdb.debuginfod/fetch_src_and_symbols.exp. ERROR: gdbserver does not support run without extended-remote while executing "error "gdbserver does not support $command without extended-remote"" (procedure "gdb_test_multiple" line 51) invoked from within =20 This was introduced with this commit: =20 commit 7dd38e31d67c2548b52bea313ab18e40824c05da Date: Fri Jan 6 18:45:27 2023 -0500 =20 gdb/linespec.c: Fix missing source file during breakpoint re-set =20 The problem is that the above commit introduces a direct use of the "run" command, which doesn't work with 'target remote' targets, as exercised by the native-gdbserver board. =20 To avoid this, in this commit I switch to using runto_main. However, calling runto_main will, by default, delete all the currently set breakpoints. As the point of the above commit was to check that a breakpoint set before stating an inferior would be correctly re-set, we need to avoid this breakpoint deleting behaviour. =20 To do this I make use of with_override, and override the delete_breakpoints proc with a dummy proc which does nothing. =20 By reverting the GDB changes in commit 7dd38e31d67c I have confirmed that even after my changes in this commit, the test still fails. But with the fixes in commit 7dd38e31d67c, this test now passed using the unix, native-gdbserver, and native-extended-gdbserver boards. Diff: --- .../gdb.debuginfod/fetch_src_and_symbols.exp | 29 +++++++++++++++---= ---- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/t= estsuite/gdb.debuginfod/fetch_src_and_symbols.exp index c9cd8a30a1c..8158c5c3cc6 100644 --- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp @@ -195,6 +195,12 @@ proc test_urls {urls pattern_re test} { $test } =20 +# Used as a replacement for delete_breakpoints while calling +# runto_main in one case where we don't want to delete all the +# breakpoints. +proc disable_delete_breakpoints {} { +} + # Uses the global variables DEBUGDIR and DB which are setup elsewhere # in this script. # @@ -214,13 +220,12 @@ proc_with_prefix local_url { } { =20 # GDB should now find the symbol and source files. clean_restart - set enable_debuginfod_question \ - "Enable debuginfod for this session. \\(y or \\\[n\\\]\\) " - gdb_test "file $binfile" "" "file [file tail $binfile]" \ - $enable_debuginfod_question "y" + gdb_test_no_output "set debuginfod enabled on" \ + "enabled debuginfod for initial test" + gdb_load $binfile gdb_test_no_output "set substitute-path $outputdir /dev/null" \ "set substitute-path" - gdb_test "br main" "Breakpoint 1 at.*file.*" + set lineno [gdb_get_line_number "Breakpoint here"] gdb_test "list $lineno" "return 0;\[^\r\n\]+Breakpoint here\\. .*" =20 @@ -228,12 +233,18 @@ proc_with_prefix local_url { } { # of the source file in the debuginfod client cache differs from # the contents of DW_AT_comp_dir and DW_AT_name. gdb_test "set cwd $debugdir" "" "file [file tail $binfile] cwd" - gdb_test_no_output "del breakpoint 1" - gdb_test "break $lineno" "Breakpoint 2 at.*file.*" - gdb_test "run" "Breakpoint 2.*" \ - "file [file tail $binfile] set breakpoint" + gdb_breakpoint $lineno + with_override delete_breakpoints disable_delete_breakpoints { + if {![runto_main]} { + return + } + gdb_continue_to_breakpoint "runto breakpoint in main" \ + ".* Breakpoint here\\. .*" + } =20 # GDB should now find the executable file. + set enable_debuginfod_question \ + "Enable debuginfod for this session. \\(y or \\\[n\\\]\\) " clean_restart gdb_test "core $::corefile" ".*return 0.*" "file [file tail $::corefil= e]" \ $enable_debuginfod_question "y"