public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote host
@ 2023-03-27 11:58 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8eef5130eeef49f489d9cd61c6c9695fc006ab39

commit 8eef5130eeef49f489d9cd61c6c9695fc006ab39
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Mar 27 13:58:10 2023 +0200

    [gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote host
    
    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.

Diff:
---
 gdb/testsuite/gdb.dwarf2/dw2-error.exp           |  6 ++++--
 gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp  |  4 +++-
 gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp |  4 +++-
 gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp  | 11 ++---------
 gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp | 10 ++++++----
 gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp     |  9 +++++----
 6 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-error.exp
index 626cf5b27f2..76886d5c1b6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-error.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-error.exp
@@ -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" *-*-*
     }
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp
index 8f8dac6f94f..f57e8086a7c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp
@@ -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
     }
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp
index dd461c33d38..0968c1c473c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp
@@ -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"
 
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
index 52dfae3d7d7..a72564c075c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
@@ -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
     }
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
index e921c105d0d..7974cb7f20b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
@@ -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
diff --git a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
index 6574f65df91..dd15e881d0c 100644
--- a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
+++ b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
@@ -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 {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-27 11:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27 11:58 [binutils-gdb] [gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote host Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).