* [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host
@ 2023-03-27 11:58 Tom de Vries
2023-03-27 11:58 ` [pushed 01/10] [gdb/testsuite] Add missing include_file in gdb.dwarf/*.exp Tom de Vries
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
Fix gdb.dwarf2/*.exp with a variaty of remote host/target boards.
Result:
...
$ ./test-all.sh
HOST/TARGET: local
# of expected passes 2199
# of known failures 3
# of unsupported tests 11
HOST: local, TARGET: native-gdbserver
# of expected passes 2192
# of known failures 3
# of unsupported tests 13
HOST: local, TARGET: native-extended-gdbserver
# of expected passes 2199
# of known failures 3
# of unsupported tests 11
HOST: local, TARGET: native-stdio-gdbserver
# of expected passes 2192
# of known failures 3
# of unsupported tests 13
HOST: local, TARGET: remote-gdbserver-on-localhost
# of expected passes 2196
# of known failures 3
# of unsupported tests 13
HOST: local, TARGET: remote-stdio-gdbserver
# of expected passes 2196
# of known failures 3
# of unsupported tests 13
HOST: local, TARGET: remote-stdio-gdbserver-remotedir
# of expected passes 2196
# of known failures 3
# of unsupported tests 13
HOST: local-remote-host-notty, TARGET: native-gdbserver
# of expected passes 1904
# of known failures 3
# of unsupported tests 23
HOST: local-remote-host-notty, TARGET: native-extended-gdbserver
# of expected passes 1911
# of known failures 3
# of unsupported tests 21
HOST: local-remote-host-notty, TARGET: remote-gdbserver-on-localhost
# of expected passes 1904
# of known failures 3
# of unsupported tests 23
HOST: local-remote-host-notty, TARGET: remote-stdio-gdbserver
# of expected passes 1904
# of known failures 3
# of unsupported tests 23
HOST: local-remote-host-notty, TARGET: remote-stdio-gdbserver-remotedir
# of expected passes 1904
# of known failures 3
# of unsupported tests 23
HOST: local-remote-host, TARGET: native-gdbserver
# of expected passes 1904
# of known failures 3
# of unsupported tests 23
HOST: local-remote-host, TARGET: native-extended-gdbserver
# of expected passes 1911
# of known failures 3
# of unsupported tests 21
HOST: local-remote-host, TARGET: remote-gdbserver-on-localhost
# of expected passes 1904
# of known failures 3
# of unsupported tests 23
HOST: local-remote-host, TARGET: remote-stdio-gdbserver
# of expected passes 1904
# of known failures 3
# of unsupported tests 23
HOST: local-remote-host, TARGET: remote-stdio-gdbserver-remotedir
# of expected passes 1904
# of known failures 3
# of unsupported tests 23
HOST/TARGET: local-remote-host-native
# of expected passes 1911
# of known failures 3
# of unsupported tests 21
...
Tom de Vries (10):
[gdb/testsuite] Add missing include_file in gdb.dwarf/*.exp
[gdb/testsuite] Fix have_index for remote host
[gdb/testsuite] Fix quoting issues in gdb.dwarf2 for remote host
[gdb/testsuite] Fix quoting issue in gdb.base/index-cache.exp
[gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote host
[gdb/testsuite] Fix gdb.dwarf2/gdb-index.exp on remote host
[gdb/testsuite] Fix gdb.dwarf2/enqueued-cu-base-addr.exp for remote
host
[gdb/testsuite] Fix gdb.dwarf2/gdb-index-cxx.exp for remote host
[gdb/testsuite] Unsupport gdb.dwarf2/gdb-add-index-symlink.exp for
remote host
[gdb/testsuite] Fix gdb.dwarf2/imported-unit-bp-c.exp for remote host
gdb/testsuite/gdb.base/index-cache.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp | 17 +++++----
gdb/testsuite/gdb.dwarf2/dw2-error.exp | 6 ++--
.../gdb.dwarf2/dw2-missing-cu-tag.exp | 4 ++-
.../gdb.dwarf2/dw2-objfile-overlap.exp | 4 ++-
.../gdb.dwarf2/dw2-ref-missing-frame.exp | 18 ++++++----
.../gdb.dwarf2/dw2-stack-boundary.exp | 11 ++----
.../gdb.dwarf2/dw2-using-debug-str.exp | 10 +++---
gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp | 2 ++
.../gdb.dwarf2/enqueued-cu-base-addr.exp | 2 +-
gdb/testsuite/gdb.dwarf2/fission-mix.exp | 2 ++
.../gdb.dwarf2/gdb-add-index-symlink.exp | 3 ++
gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp | 2 +-
gdb/testsuite/gdb.dwarf2/gdb-index.exp | 36 +++++++++++++------
.../gdb.dwarf2/imported-unit-bp.exp.tcl | 5 +++
.../locexpr-data-member-location.exp | 1 +
gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp | 11 +++---
gdb/testsuite/lib/gdb.exp | 27 +++++++++++++-
18 files changed, 114 insertions(+), 49 deletions(-)
base-commit: 2b3f4c0616abffb2a1a29543cb649483b1722db4
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pushed 01/10] [gdb/testsuite] Add missing include_file in gdb.dwarf/*.exp
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host Tom de Vries
@ 2023-03-27 11:58 ` Tom de Vries
2023-03-27 11:58 ` [pushed 02/10] [gdb/testsuite] Fix have_index for remote host Tom de Vries
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
---
gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp | 2 ++
gdb/testsuite/gdb.dwarf2/fission-mix.exp | 2 ++
gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp | 1 +
3 files changed, 5 insertions(+)
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp
index 06ce4906f07..c08179fe5e9 100644
--- a/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp
@@ -17,6 +17,8 @@
standard_testfile .cc -b.cc
+include_file dw4-sig-types.h
+
# This test is intended for targets which support DWARF-4.
# Since we pass an explicit -gdwarf-4 -fdebug-types-section to the compiler,
# we let that be the test of whether the target supports it.
diff --git a/gdb/testsuite/gdb.dwarf2/fission-mix.exp b/gdb/testsuite/gdb.dwarf2/fission-mix.exp
index a396747714d..1e78de6990e 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-mix.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-mix.exp
@@ -19,6 +19,8 @@ load_lib dwarf.exp
require dwarf2_support
standard_testfile .c -2.c
+include_file fission-mix.h
+
set objfile [standard_output_file ${testfile}.o]
set objfile2 [standard_output_file ${testfile}2.o]
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
index a5b301e26fb..5bdc3e49b1c 100644
--- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
@@ -67,6 +67,7 @@ set lib_basename ${::gdb_test_file_name}-lib
# which will be ${srcfile3} after the execution of standard_testfile.
standard_testfile $main_basename.c $lib_basename.c $lib_basename.S
+include_file locexpr-data-member-location.h
set libsrc "${::srcdir}/${::subdir}/${::srcfile2}"
set lib_so [standard_output_file ${lib_basename}.so]
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pushed 02/10] [gdb/testsuite] Fix have_index for remote host
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host 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 ` Tom de Vries
2023-03-27 11:58 ` [pushed 03/10] [gdb/testsuite] Fix quoting issues in gdb.dwarf2 " Tom de Vries
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
Proc have_index is mostly used with $binfile, which gives problems
for remote host.
Fix this by using "file tail" on the proc argument.
Tested on x86_64-linux.
---
gdb/testsuite/lib/gdb.exp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 813b755215e..c0762cbb3a8 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -8740,6 +8740,10 @@ proc readnow { } {
# Otherwise, return "".
proc have_index { objfile } {
+ # This proc is mostly used with $binfile, but that gives problems with
+ # remote host, while using $testfile would work.
+ # Fix this by reducing $binfile to $testfile.
+ set objfile [file tail $objfile]
set res ""
set cmd "maint print objfiles $objfile"
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pushed 03/10] [gdb/testsuite] Fix quoting issues in gdb.dwarf2 for remote host
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host 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 ` 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
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
A few test-cases in gdb.dwarf2 use something like:
...
additional_flags=\"-DFOO=BAR + 10\"
...
which doesn't work on remote host.
Fix this by introducing a new proc quote_for_host that also works for remote
host, such that we have:
...
additional_flags=[quote_for_host -DFOO=BAR + 10]
...
Tested on x86_64-linux.
---
gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp | 17 ++++++++++-------
.../gdb.dwarf2/dw2-ref-missing-frame.exp | 18 ++++++++++++------
gdb/testsuite/lib/gdb.exp | 13 +++++++++++++
3 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
index 2ec3d11d8ac..0868b69f15e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
@@ -37,13 +37,16 @@ set sources \
${testfile}-hello.c \
${testfile}-world-dbg.S \
${testfile}-world.c]
-set flags \
- [list \
- "nodebug" \
- "additional_flags=\"-DHELLO_START=$hello_start\"" \
- "additional_flags=\"-DHELLO_END=$hello_start + $hello_len\"" \
- "additional_flags=\"-DWORLD_START=$world_start\"" \
- "additional_flags=\"-DWORLD_END=$world_start + $world_len\""]
+
+set flags {}
+lappend flags nodebug
+lappend flags additional_flags=[quote_for_host -DHELLO_START=$hello_start]
+lappend flags additional_flags=[quote_for_host -DHELLO_END=$hello_start \
+ + $hello_len]
+lappend flags additional_flags=[quote_for_host -DWORLD_START=$world_start]
+lappend flags additional_flags=[quote_for_host -DWORLD_END=$world_start \
+ + $world_len]
+
set executable ${testfile}
if {[build_executable ${testfile}.exp ${executable} $sources $flags] == -1} {
return -1
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
index d9a552a8c9d..09c484a8ebb 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
@@ -25,12 +25,18 @@ lassign [function_range func_loopfb \
"${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}"] \
func_loopfb_start func_loopfb_len
-set flags \
- [list \
- "additional_flags=\"-DFUNC_NOFB_START=$func_nofb_start\"" \
- "additional_flags=\"-DFUNC_NOFB_END=$func_nofb_start + $func_nofb_len\"" \
- "additional_flags=\"-DFUNC_LOOPFB_START=$func_loopfb_start\"" \
- "additional_flags=\"-DFUNC_LOOPFB_END=$func_loopfb_start + $func_loopfb_len\""]
+set flags {}
+lappend flags \
+ additional_flags=[quote_for_host -DFUNC_NOFB_START=$func_nofb_start]
+lappend flags \
+ additional_flags=[quote_for_host -DFUNC_NOFB_END=$func_nofb_start \
+ + $func_nofb_len]
+lappend flags \
+ additional_flags=[quote_for_host -DFUNC_LOOPFB_START=$func_loopfb_start]
+lappend flags \
+ additional_flags=[quote_for_host -DFUNC_LOOPFB_END=$func_loopfb_start \
+ + $func_loopfb_len]
+
set executable ${testfile}
if { [prepare_for_testing_full "failed to prepare" \
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index c0762cbb3a8..2cf128fdd68 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4700,6 +4700,19 @@ proc escape_for_host { str } {
return [string map $map $str]
}
+# Add double quotes around ARGS, sufficiently escaped for use on host
+# commandline.
+
+proc quote_for_host { args } {
+ set str [join $args]
+ if { [is_remote host] } {
+ set str [join [list {\"} $str {\"}] ""]
+ } else {
+ set str [join [list {"} $str {"}] ""]
+ }
+ return $str
+}
+
# Compile source files specified by SOURCE into a binary of type TYPE at path
# DEST. gdb_compile is implemented using DejaGnu's target_compile, so the type
# parameter and most options are passed directly to it.
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pushed 04/10] [gdb/testsuite] Fix quoting issue in gdb.base/index-cache.exp
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host Tom de Vries
` (2 preceding siblings ...)
2023-03-27 11:58 ` [pushed 03/10] [gdb/testsuite] Fix quoting issues in gdb.dwarf2 " Tom de Vries
@ 2023-03-27 11:58 ` Tom de Vries
2023-03-27 11:58 ` [pushed 05/10] [gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote host Tom de Vries
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
For test-case gdb.base/index-cache.exp and remote host, this:
...
lassign [remote_exec host sh "-c \"rm $cache_dir/*.gdb-index\""] ret
...
gives us:
...
Executing on host: sh -c rm /tmp/tmp.m3L7m2AVkL/*.gdb-index (timeout = 300)
builtin_spawn -ignore SIGHUP sh -c rm /tmp/tmp.m3L7m2AVkL/*.gdb-index^M
rm: missing operand^M
Try 'rm --help' for more information.^M
FAIL: gdb.dwarf2/per-bfd-sharing.exp: couldn't remove files in temporary cache dir
...
Fix this using quote_for_host. Likewise in gdb.dwarf2/per-bfd-sharing.exp.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.base/index-cache.exp | 2 +-
gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.base/index-cache.exp b/gdb/testsuite/gdb.base/index-cache.exp
index ec69f0f11ad..9f2f53053cb 100644
--- a/gdb/testsuite/gdb.base/index-cache.exp
+++ b/gdb/testsuite/gdb.base/index-cache.exp
@@ -245,7 +245,7 @@ test_cache_enabled_hit $cache_dir
# Test again with the cache disabled, now that it is populated.
test_cache_disabled $cache_dir "after populate"
-lassign [remote_exec host sh "-c \"rm $cache_dir/*.gdb-index\""] ret
+lassign [remote_exec host "sh -c" [quote_for_host rm $cache_dir/*.gdb-index]] ret
if { $ret != 0 && $expecting_index_cache_use } {
fail "couldn't remove files in temporary cache dir"
return
diff --git a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
index 46284c2b775..6574f65df91 100644
--- a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
+++ b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
@@ -96,7 +96,7 @@ foreach_with_prefix first $methods {
}
}
-lassign [remote_exec host sh "-c \"rm $cache_dir/*.gdb-index\""] ret
+lassign [remote_exec host "sh -c" [quote_for_host rm $cache_dir/*.gdb-index]] ret
if { $ret != 0 && $expecting_index_cache_use } {
fail "couldn't remove files in temporary cache dir"
return
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pushed 05/10] [gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote host
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host Tom de Vries
` (3 preceding siblings ...)
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
2023-03-27 11:58 ` [pushed 06/10] [gdb/testsuite] Fix gdb.dwarf2/gdb-index.exp on " Tom de Vries
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pushed 06/10] [gdb/testsuite] Fix gdb.dwarf2/gdb-index.exp on remote host
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host Tom de Vries
` (4 preceding siblings ...)
2023-03-27 11:58 ` [pushed 05/10] [gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote host Tom de Vries
@ 2023-03-27 11:58 ` 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
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
Fix test-case gdb.dwarf2/gdb-index.exp on remote host using
gdb_remote_download and host_standard_output_file.
Also declare the test-case unsupported with readnow.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.dwarf2/gdb-index.exp | 36 +++++++++++++++++++-------
gdb/testsuite/lib/gdb.exp | 7 ++++-
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index.exp b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
index 8a12e35f353..c28f45c5e5c 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
@@ -18,6 +18,9 @@ load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2.
require dwarf2_support
+# Can't save an index with readnow.
+require !readnow
+
standard_testfile main.c
if { [prepare_for_testing "failed to prepare" "${testfile}" \
@@ -32,16 +35,17 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \
# Use local prefix to prevent overriding add_gdb_index from lib/gdb.exp.
proc local_add_gdb_index { program } {
- set index_file ${program}.gdb-index
- set dir [file dirname ${program}]
set filename [file tail ${program}]
- set dwz $dir/.tmp/${filename}.dwz
- set dwz_index_file $program.dwz.gdb-index
+ set host_program [gdb_remote_download host $program]
+ set index_file [host_standard_output_file $filename.gdb-index]
+ set tmpdir [host_standard_output_file .tmp]
+ set dwz $tmpdir/$filename.dwz
+ set dwz_index_file [host_standard_output_file $filename.dwz.gdb-index]
verbose -log "index_file: ${index_file}"
remote_file host delete ${index_file}
remote_file host delete ${dwz_index_file}
gdb_test_no_output "save gdb-index [file dirname ${index_file}]" \
- "save gdb-index for file [file tail ${program}]"
+ "save gdb-index for file $filename"
# No point in continuing if generating the index failed.
# N.B.: There are times when gdb won't create an index, and it's not a
@@ -55,8 +59,16 @@ proc local_add_gdb_index { program } {
return ""
}
- set program_with_index ${program}.with-index
- if {[run_on_host "objcopy" [gdb_find_objcopy] "--remove-section .gdb_index --add-section .gdb_index=$index_file --set-section-flags .gdb_index=readonly ${program} ${program_with_index}"]} {
+ set host_program_with_index $host_program.with-index
+ set program_with_index $program.with-index
+ if {[run_on_host "objcopy" [gdb_find_objcopy] \
+ [join \
+ [list \
+ "--remove-section .gdb_index" \
+ "--add-section .gdb_index=$index_file" \
+ "--set-section-flags .gdb_index=readonly" \
+ "$host_program" \
+ "$host_program_with_index"]]]} {
return ""
}
@@ -73,7 +85,9 @@ proc local_add_gdb_index { program } {
}
}
- return ${program_with_index}
+ return [list \
+ [remote_upload host $host_program_with_index $program_with_index] \
+ $host_program_with_index]
}
# Build a copy of the program with an index (.gdb_index/.debug_names).
@@ -84,12 +98,14 @@ set test "check if index present"
gdb_test_multiple "mt print objfiles ${testfile}" $test {
-re "gdb_index.*${gdb_prompt} $" {
set binfile_with_index $binfile
+ set host_binfile_with_index [gdb_remote_download host $binfile]
}
-re "debug_names.*${gdb_prompt} $" {
set binfile_with_index $binfile
+ set host_binfile_with_index [gdb_remote_download host $binfile]
}
-re "(Psymtabs|Cooked).*${gdb_prompt} $" {
- set binfile_with_index [local_add_gdb_index $binfile]
+ lassign [local_add_gdb_index $binfile] binfile_with_index host_binfile_with_index
if { ${binfile_with_index} == "" } {
return -1
}
@@ -114,7 +130,7 @@ gdb_test "mt print objfiles ${testfile}" \
# Is touch portable enough?
# First make sure enough time has passed, file mtime resolution is seconds.
gdb_test_no_output "shell sleep 1"
-if {[run_on_host "touch binary" touch ${binfile_with_index}]} {
+if {[run_on_host "touch binary" touch $host_binfile_with_index]} {
return -1
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2cf128fdd68..39ed5ad761b 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6412,7 +6412,12 @@ proc standard_output_file {basename} {
proc host_standard_output_file { basename } {
if { [is_remote host] } {
- return $basename
+ set remotedir [board_info host remotedir]
+ if { $remotedir == "" } {
+ return $basename
+ } else {
+ return [join [list $remotedir $basename] "/"]
+ }
} else {
return [standard_output_file $basename]
}
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pushed 07/10] [gdb/testsuite] Fix gdb.dwarf2/enqueued-cu-base-addr.exp for remote host
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host Tom de Vries
` (5 preceding siblings ...)
2023-03-27 11:58 ` [pushed 06/10] [gdb/testsuite] Fix gdb.dwarf2/gdb-index.exp on " Tom de Vries
@ 2023-03-27 11:58 ` Tom de Vries
2023-03-27 11:58 ` [pushed 08/10] [gdb/testsuite] Fix gdb.dwarf2/gdb-index-cxx.exp " Tom de Vries
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
Fix test-case gdb.dwarf2/enqueued-cu-base-addr.exp for remote host by using
$testfile instead $binfile.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
index 658a9a4bb79..b60c02085b4 100644
--- a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
@@ -89,7 +89,7 @@ set cu2_blockvector_re \
"" \
"block #000, \[^\r\n\]* in ($hex)..$hex" \
".*"]
-gdb_test_multiple "maint print symbols -objfile $binfile" "CU addr found" {
+gdb_test_multiple "maint print symbols -objfile $testfile" "CU addr found" {
-re -wrap $cu2_blockvector_re {
set addr $expect_out(1,string)
if { $addr eq "0x0" } {
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pushed 08/10] [gdb/testsuite] Fix gdb.dwarf2/gdb-index-cxx.exp for remote host
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host Tom de Vries
` (6 preceding siblings ...)
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 ` 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
9 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
Fix test-case gdb.dwarf2/gdb-index-cxx.exp for remote host using
host_standard_output_file.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp | 2 +-
gdb/testsuite/lib/gdb.exp | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp
index 3c3d6cc463d..6fffc982722 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" "${testfile}" \
}
# The bug was that gdb would crash when saving.
-set output_dir [standard_output_file ""]
+set output_dir [host_standard_output_file ""]
set cmd "save gdb-index"
gdb_test_multiple "$cmd $output_dir" $cmd {
-re -wrap "Cannot use an index to create the index.*" {
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 39ed5ad761b..14ce39e8ed7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6414,6 +6414,9 @@ proc host_standard_output_file { basename } {
if { [is_remote host] } {
set remotedir [board_info host remotedir]
if { $remotedir == "" } {
+ if { $basename == "" } {
+ return "."
+ }
return $basename
} else {
return [join [list $remotedir $basename] "/"]
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pushed 09/10] [gdb/testsuite] Unsupport gdb.dwarf2/gdb-add-index-symlink.exp for remote host
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host Tom de Vries
` (7 preceding siblings ...)
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 ` Tom de Vries
2023-03-27 11:58 ` [pushed 10/10] [gdb/testsuite] Fix gdb.dwarf2/imported-unit-bp-c.exp " Tom de Vries
9 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
Declare test-case gdb.dwarf2/gdb-add-index-symlink.exp unsupported for remote
host, because the current implementation of gdb_ensure_index doesn't support it.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp b/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp
index b9d99c314dc..d6f96ab9f5b 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp
@@ -18,6 +18,9 @@ load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2.
require dwarf2_support
+# The current implementation of ensure_gdb_index doesn't work on remote host.
+require {!is_remote host}
+
standard_testfile main.c
# First check whether we can actually handle the non-symlink case.
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pushed 10/10] [gdb/testsuite] Fix gdb.dwarf2/imported-unit-bp-c.exp for remote host
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host Tom de Vries
` (8 preceding siblings ...)
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 ` Tom de Vries
9 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2023-03-27 11:58 UTC (permalink / raw)
To: gdb-patches
Fix test-case gdb.dwarf2/imported-unit-bp-c.exp on remote by removing a
downloaded source file.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
index 6bef2bdb089..62dee7d7992 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
@@ -122,5 +122,10 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
gdb_reinitialize_dir /tmp
+# Compilation on remote host downloads the source files to remote host, but
+# doesn't clean them up, allowing gdb to find $srcfile, in contrast to
+# non-remote host.
+remote_file host delete $srcfile
+
# Using an absolute path is important to see the bug.
gdb_test "break /tmp/${srcfile}:19" "Breakpoint .* file $srcfile, line .*"
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-03-27 11:59 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27 11:58 [pushed 00/10] [gdb/testsuite] Fix gdb.dwarf2 for remote host 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 ` [pushed 05/10] [gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote host Tom de Vries
2023-03-27 11:58 ` [pushed 06/10] [gdb/testsuite] Fix gdb.dwarf2/gdb-index.exp on " 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
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).