public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 05/10] [gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote host
Date: Mon, 27 Mar 2023 13:58:53 +0200	[thread overview]
Message-ID: <20230327115858.5950-6-tdevries@suse.de> (raw)
In-Reply-To: <20230327115858.5950-1-tdevries@suse.de>

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           |  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 {
-- 
2.35.3


  parent reply	other threads:[~2023-03-27 11:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 " Tom de Vries
2023-03-27 11:58 ` [pushed 01/10] [gdb/testsuite] Add missing include_file in gdb.dwarf/*.exp Tom de Vries
2023-03-27 11:58 ` [pushed 02/10] [gdb/testsuite] Fix have_index for remote host Tom de Vries
2023-03-27 11:58 ` [pushed 03/10] [gdb/testsuite] Fix quoting issues in gdb.dwarf2 " Tom de Vries
2023-03-27 11:58 ` [pushed 04/10] [gdb/testsuite] Fix quoting issue in gdb.base/index-cache.exp Tom de Vries
2023-03-27 11:58 ` Tom de Vries [this message]
2023-03-27 11:58 ` [pushed 06/10] [gdb/testsuite] Fix gdb.dwarf2/gdb-index.exp on remote host Tom de Vries
2023-03-27 11:58 ` [pushed 07/10] [gdb/testsuite] Fix gdb.dwarf2/enqueued-cu-base-addr.exp for " Tom de Vries
2023-03-27 11:58 ` [pushed 08/10] [gdb/testsuite] Fix gdb.dwarf2/gdb-index-cxx.exp " Tom de Vries
2023-03-27 11:58 ` [pushed 09/10] [gdb/testsuite] Unsupport gdb.dwarf2/gdb-add-index-symlink.exp " Tom de Vries
2023-03-27 11:58 ` [pushed 10/10] [gdb/testsuite] Fix gdb.dwarf2/imported-unit-bp-c.exp " Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230327115858.5950-6-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).