gdb/testsuite: fix fetch_src_and_symbols.exp with native-gdbserver board
authorAndrew Burgess <aburgess@redhat.com>
Wed, 1 Feb 2023 17:09:47 +0000 (17:09 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Wed, 1 Feb 2023 17:32:16 +0000 (17:32 +0000)
commitcded17bfca35566fa4d36e9ec06fa071bd7dab17
tree0a401cd92f4e709a7ee54f6b5d6e6806367299ce
parent6647f05df023b63bbe056e9167e9e234172fa2ca
gdb/testsuite: fix fetch_src_and_symbols.exp with native-gdbserver board

I noticed that the gdb.debuginfod/fetch_src_and_symbols.exp script
doesn't work with the native-gdbserver board, I see this error:

  ERROR: tcl error sourcing /tmp/build/gdb/testsuite/../../../src/gdb/testsuite/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

This was introduced with this commit:

  commit 7dd38e31d67c2548b52bea313ab18e40824c05da
  Date:   Fri Jan 6 18:45:27 2023 -0500

      gdb/linespec.c: Fix missing source file during breakpoint re-set

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.

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.

To do this I make use of with_override, and override the
delete_breakpoints proc with a dummy proc which does nothing.

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.
gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp