]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote host
authorTom de Vries <tdevries@suse.de>
Mon, 27 Mar 2023 11:58:10 +0000 (13:58 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 27 Mar 2023 11:58:10 +0000 (13:58 +0200)
Fix test-case gdb.dwarf2/per-bfd-sharing.exp for remote host using
gdb_remote_download.

Likewise in a few other test-cases.

Tested on x86_64-linux.

gdb/testsuite/gdb.dwarf2/dw2-error.exp
gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp
gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp
gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp

index 626cf5b27f280f9c5fb5763abab1293f6ea8d184..76886d5c1b6e6fb1a7efd1b6ea7cf969baabd1c2 100644 (file)
@@ -32,13 +32,15 @@ clean_restart
 
 gdb_test_no_output "set breakpoint pending off"
 
+set host_binfile [gdb_remote_download host $binfile]
+
 # First test that reading symbols fails.
-gdb_test "file $binfile" \
+gdb_test "file $host_binfile" \
     {Reading symbols.*Dwarf Error: wrong version in compilation unit header \(is 153, should be 2, 3, 4 or 5\).*} \
     "file $testfile"
 
 # We can't use proc readnow, because the PR makes it return 0.
-gdb_test_multiple "maint print objfiles $binfile" "" {
+gdb_test_multiple "maint print objfiles $host_binfile" "" {
     -re "^maint print objfiles \[^\r\n\]*\r\n$gdb_prompt $" {
        setup_kfail "gdb/26797" *-*-*
     }
index 8f8dac6f94fe7fcc5fdec2888826af4627749ea8..f57e8086a7c58bac99ccf6689588c1f0885f9a33 100644 (file)
@@ -44,6 +44,8 @@ if {[build_executable "failed to build executable" $testfile \
     return -1
 }
 
+set host_binfile [gdb_remote_download host $binfile]
+
 # Restart with no executable.
 clean_restart
 
@@ -63,7 +65,7 @@ set pattern2 \
         "Dwarf Error: unexpected tag 'DW_TAG_subprogram' at offset $hex"]
 
 # Load the executable, we expect an error from the DWARF parser.
-gdb_test_multiple "file $binfile" "file $testfile" {
+gdb_test_multiple "file $host_binfile" "file $testfile" {
     -wrap -re $pattern1 {
        pass $gdb_test_name
     }
index dd461c33d380191b3de2820fb44196d8a63cf8a1..0968c1c473ca570e32aacbac31808c27c809d4d9 100644 (file)
@@ -34,7 +34,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile_outer}" "${binfile_outer}" \
 
 clean_restart $executable_outer
 
-gdb_test "add-symbol-file $binfile_inner outer_inner" \
+set host_binfile_inner [gdb_remote_download host $binfile_inner]
+
+gdb_test "add-symbol-file $host_binfile_inner outer_inner" \
          {Reading symbols from .*\.\.\.} "add-symbol-file" \
         "\r\n\t\\.text_addr = 0x\[0-9a-f\]+\r\n\\(y or n\\) \$" "y"
 
index 52dfae3d7d7ea26b5bf4f5b04c2a9c8432306e58..a72564c075c160df6d463f8a58e9194a384c535b 100644 (file)
@@ -25,18 +25,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != ""
 
 clean_restart
 
-# From gdb_file_cmd:
-if [is_remote host] {
-    set arg [remote_download host $binfile]
-    if { $arg == "" } {
-       perror "download failed"
-       return -1
-    }
-}
+set host_binfile [gdb_remote_download host $binfile]
 gdb_test_no_output "set complaints 100"
 set w1 0
 set w2 0
-gdb_test_multiple "file $binfile" "file command" {
+gdb_test_multiple "file $host_binfile" "file command" {
     -re "\r\nReading symbols from \[^\r\n\]*\\.\\.\\." {
        exp_continue
     }
index e921c105d0d2683d3adec29369bdf312141153c2..7974cb7f20b883bd2d7d6ec69056c524e59994cd 100644 (file)
@@ -98,12 +98,14 @@ if ![runto_main] {
 # field names, all of which are stored in the .debug_str section.
 gdb_test "p global_var" " = \\{aa = 0, bb = 0, cc = 0\\}"
 
+set host_binfile [gdb_remote_download host $binfile]
+
 # Verify that the executable actually contains a .debug_str section, before
 # trying to remove it.  This can be missing with target boards
 # cc-with-dwz-m.exp and cc-with-gnu-debuglink.exp.  Handle this by
 # skipping the remainder of the test-case.
-set debug_str_section "${binfile}-debug-str"
-set args "--dump-section .debug_str=${debug_str_section} $binfile"
+set debug_str_section "${host_binfile}-debug-str"
+set args "--dump-section .debug_str=${debug_str_section} $host_binfile"
 set result [remote_exec host "[gdb_find_objcopy] $args"]
 set status [lindex $result 0]
 set output [lindex $result 1]
@@ -115,8 +117,8 @@ if { $status == 0 && ![string equal $output ""] } {
 # creates an executable with an invalid DWARF configuration.  GDB
 # should give an error when trying to read the debug information from
 # this executable.
-set binfile_no_debug_str "${binfile}-no-debug-str"
-set args "--remove-section .debug_str $binfile ${binfile_no_debug_str}"
+set binfile_no_debug_str "${host_binfile}-no-debug-str"
+set args "--remove-section .debug_str $host_binfile ${binfile_no_debug_str}"
 if {[run_on_host "objcopy" [gdb_find_objcopy] "$args"]} {
     perror "failed to run objcopy"
     return -1
index 6574f65df9136ba7467116d962989165f9b7c7e1..dd15e881d0c09de0645b0c5938894cb0e3e544a2 100644 (file)
@@ -22,6 +22,7 @@ if { [build_executable "failed to prepare" $testfile $srcfile \
          {debug ldflags=-Wl,--build-id}] == -1 } {
     return
 }
+set host_binfile [gdb_remote_download host $binfile]
 
 set has_index_section [exec_has_index_section $binfile]
 set uses_readnow [expr [string first "-readnow" $GDBFLAGS] != -1]
@@ -46,7 +47,7 @@ with_test_prefix "populate index cache" {
     gdb_test_no_output "set index-cache directory $cache_dir" \
        "set index-cache directory"
     gdb_test_no_output "set index-cache enabled on"
-    gdb_test "file $binfile" "Reading symbols from .*" "file"
+    gdb_test "file $host_binfile" "Reading symbols from .*" "file"
 }
 
 proc load_binary { method } {
@@ -54,13 +55,13 @@ proc load_binary { method } {
     global hex
 
     if { $method == "standard" } {
-       gdb_test "file $binfile" "Reading symbols from .*" "file"
+       gdb_test "file $::host_binfile" "Reading symbols from .*" "file"
     } elseif { $method == "index" } {
        gdb_test_no_output "set index-cache enabled on"
-       gdb_test "file $binfile" "Reading symbols from .*" "file index"
+       gdb_test "file $::host_binfile" "Reading symbols from .*" "file index"
        gdb_test_no_output "set index-cache enabled off"
     } elseif { $method == "readnow" } {
-       gdb_test "file -readnow $binfile" \
+       gdb_test "file -readnow $::host_binfile" \
            "Reading symbols from .*Expanding full symbols from .*" \
            "file readnow"
     } else {