aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-03-27 13:58:10 +0200
committerTom de Vries <tdevries@suse.de>2023-03-27 13:58:10 +0200
commit8eef5130eeef49f489d9cd61c6c9695fc006ab39 (patch)
tree6f3f30a02d371249d43a8430762ddef351347dfd
parent0ecbda2f31962df07aaa355c9e7c8bcefb7c97d9 (diff)
downloadbinutils-8eef5130eeef49f489d9cd61c6c9695fc006ab39.zip
binutils-8eef5130eeef49f489d9cd61c6c9695fc006ab39.tar.gz
binutils-8eef5130eeef49f489d9cd61c6c9695fc006ab39.tar.bz2
[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.
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-error.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp11
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp10
-rw-r--r--gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp9
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 626cf5b..76886d5 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 8f8dac6..f57e808 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 dd461c3..0968c1c 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 52dfae3..a72564c 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 e921c10..7974cb7 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 6574f65..dd15e88 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 {