[gdb/testsuite] Fix gdb.base/jit-elf-so.exp for remote target
authorTom de Vries <tdevries@suse.de>
Tue, 15 Nov 2022 14:24:54 +0000 (15:24 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 15 Nov 2022 14:24:54 +0000 (15:24 +0100)
With test-case gdb.base/jit-elf-so.exp and target board
remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some
failures.

Fix these by:
- setting jit_libname with the name as returned by gdb_load_shlib
- allowing the libraries to be prefixed with the remote target directory.

Tested on x86_64-linux.

Co-Authored-by: Ivan Tetyushkin <ivan.tetyushkin@syntacore.com>
gdb/testsuite/gdb.base/jit-elf-so.exp

index dcc9afc36b9b851d7090dd4a976316edc09c05dc..d5f566007015fe5fed68a8c2cc97fcf72d1244f5 100644 (file)
@@ -73,10 +73,10 @@ proc one_jit_test {solib_binfiles_target match_str} {
     with_test_prefix "one_jit_test-$count" {
        global test_verbose
        global main_loader_binfile main_loader_srcfile
-       global main_solib_binfile main_solib_srcfile
+       global main_solib_binfile main_solib_binfile_target main_solib_srcfile
 
        clean_restart $main_loader_binfile
-       gdb_load_shlib $main_solib_binfile
+       gdb_locate_shlib $main_solib_binfile
 
        # This is just to help debugging when things fail
        if {$test_verbose > 0} {
@@ -90,7 +90,7 @@ proc one_jit_test {solib_binfiles_target match_str} {
        gdb_breakpoint [gdb_get_line_number "break here before-dlopen" \
                            $main_loader_srcfile]
        gdb_continue_to_breakpoint "break here before-dlopen"
-       gdb_test_no_output "set var jit_libname = \"$main_solib_binfile\"" \
+       gdb_test_no_output "set var jit_libname = \"$main_solib_binfile_target\"" \
            "setting library name"
 
        gdb_breakpoint [gdb_get_line_number "break here after-dlopen" \
@@ -140,6 +140,9 @@ if { [compile_jit_elf_main_as_so $main_solib_srcfile $main_solib_binfile \
     return
 }
 
+set main_solib_binfile_target \
+    [gdb_download_shlib $main_solib_binfile]
+
 # Compile the "real" main for this test.
 if { [compile_jit_dlmain {shlib_load}] < 0 } {
     return
@@ -161,6 +164,6 @@ foreach solib $jit_solibs_target {
     set input [string range $solib 0 [expr { [string length $solib] - 2 }]]
     gdb_test \
        "complete jit-reader-load [standard_output_file $input]" \
-       "jit-reader-load $solib" \
+       "jit-reader-load \[^\r\n\]*$solib" \
        "test jit-reader-load filename completion [file tail $solib]"
 }