[pushed,3/6,gdb/testsuite] Fix gdb.server/solib-list.exp for remote host

Message ID 20230328154855.32238-4-tdevries@suse.de
State Committed
Headers
Series Fix gdb.server for remote host |

Commit Message

Tom de Vries March 28, 2023, 3:48 p.m. UTC
  Fix test-case gdb.server/solib-list.exp for remote host using
gdb_remote_download.

Likewise in another test-case.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.server/bkpt-other-inferior.exp | 3 ++-
 gdb/testsuite/gdb.server/solib-list.exp          | 9 +++++----
 2 files changed, 7 insertions(+), 5 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.server/bkpt-other-inferior.exp b/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
index d4395d2c441..88f84a1228d 100644
--- a/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
+++ b/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
@@ -27,6 +27,7 @@  if { [prepare_for_testing "failed to prepare" ${binfile} "${srcfile}" \
 	  {debug pthreads}] } {
     return
 }
+set host_binfile [gdb_remote_download host $binfile]
 
 # Make sure we're disconnected, in case we're testing with an
 # extended-remote board, therefore already connected.
@@ -39,7 +40,7 @@  gdb_test "add-inferior" "Added inferior 2" \
     "add inferior 2"
 gdb_test "inferior 2" "Switching to inferior 2.*" \
     "switch to inferior 2"
-gdb_test "file ${binfile}" ".*" "load file in inferior 2"
+gdb_test "file ${host_binfile}" ".*" "load file in inferior 2"
 
 set target_exec [gdbserver_download_current_prog]
 
diff --git a/gdb/testsuite/gdb.server/solib-list.exp b/gdb/testsuite/gdb.server/solib-list.exp
index 2a239838477..564878be018 100644
--- a/gdb/testsuite/gdb.server/solib-list.exp
+++ b/gdb/testsuite/gdb.server/solib-list.exp
@@ -51,14 +51,15 @@  foreach nonstop { 0 1 } { with_test_prefix "non-stop $nonstop" {
 
     gdb_load_shlib ${binlibfile}
 
-    set remote_binfile [gdb_remote_download target $binfile]
+    set target_binfile [gdb_remote_download target $binfile]
+    set host_binfile [gdb_remote_download host $binfile]
 
     # When testing remote, the file path we receive may be only the file name,
     # "solib-list".  ld-linux doesn't seem to be able to find the file when
     # passing just the file name, it wants either the absolute path or a
     # relative path with at least one directory component.  Calling readlink on
     # the target to get the full path will make it happy.
-    set remote_binfile [lindex [remote_exec target "readlink -f $remote_binfile"] 1]
+    set target_binfile [lindex [remote_exec target "readlink -f $target_binfile"] 1]
 
     # Make sure we're disconnected, in case we're testing with an
     # extended-remote board, therefore already connected.
@@ -81,7 +82,7 @@  foreach nonstop { 0 1 } { with_test_prefix "non-stop $nonstop" {
     # argument here, instead of using gdb_load, because we don't want
     # to download the interpreter to the target (it's already there)
     # or to the test output directory.
-    set res [gdbserver_spawn "${interp_system} ${remote_binfile}"]
+    set res [gdbserver_spawn "${interp_system} ${target_binfile}"]
     set gdbserver_protocol [lindex $res 0]
     set gdbserver_gdbport [lindex $res 1]
 
@@ -89,7 +90,7 @@  foreach nonstop { 0 1 } { with_test_prefix "non-stop $nonstop" {
     # but before "target remote" below so that qSymbol data get already
     # initialized from BINFILE (and not from ld.so first needing a change to
     # BINFILE later).
-    gdb_test "file ${binfile}" {Reading symbols from .*\.\.\..*} "file binfile"
+    gdb_test "file ${host_binfile}" {Reading symbols from .*\.\.\..*} "file binfile"
 
     set test "target $gdbserver_protocol"
     set ok 0