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 1/5] [gdb/testsuite] Fix gdb.arch/amd64*.exp with local-remote-host-native.exp
Date: Wed, 15 Mar 2023 16:38:33 +0100	[thread overview]
Message-ID: <20230315153837.21440-2-tdevries@suse.de> (raw)
In-Reply-To: <20230315153837.21440-1-tdevries@suse.de>

There's a number of gdb.arch/amd64*.exp test-cases that fail with host+target
board local-remote-host-native.exp because of using a .S file, generated from
a .c file.

If a test-case compiles the .S file when executing on remote host,
the .S file is already copied from build to host, such that it's available for
the compiler.

But that's not the case for the .c file, which is needed by gdb to show a
source line:
...
(gdb) continue^M
Continuing.^M
^M
Breakpoint 2, fn2 (y=y@entry=25, x=x@entry=6) at amd64-entry-value-inline.c:32^M
32      in gdb.arch/amd64-entry-value-inline.c^M
(gdb) FAIL: gdb.arch/amd64-entry-value-inline.exp: continue to breakpoint: \
  break-here
...

Fix this by using "gdb_remote_download host <.c file>".

Tested on x86_64-linux, with host+target board local-remote-host-native.
---
 gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp  | 12 ++++++++----
 .../gdb.arch/amd64-entry-value-param-dwarf5.exp      | 10 +++++++---
 gdb/testsuite/gdb.arch/amd64-entry-value-param.exp   | 10 +++++++---
 .../gdb.arch/amd64-entry-value-paramref.exp          |  8 ++++++--
 gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp        |  9 +++++++--
 5 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
index 774b90bcdb0..d9920146fa4 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
@@ -14,16 +14,21 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 set opts {}
-standard_testfile .S
+standard_testfile .S .c
 
 if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1"
-    standard_testfile
+    standard_testfile .c .c
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
 }
 
+# Make .c available on the host.
+if [is_remote host] {
+    gdb_remote_download host $srcdir/$subdir/$srcfile2
+}
+
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
     return -1
 }
@@ -32,8 +37,7 @@ if ![runto_main] {
     return -1
 }
 
-set srcfile $testfile.c
-gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_breakpoint [gdb_get_line_number "break-here" $srcfile2]
 
 gdb_continue_to_breakpoint "break-here" ".* break-here .*"
 gdb_test "p y" " = 25"
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
index f6d11b26cc7..17a92bdcbf5 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
@@ -18,12 +18,17 @@ set opts {}
 
 if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param-dwarf5.exp COMPILE=1"
-    set srcfile ${srcfile2}
+    standard_testfile .c .c
     lappend opts optimize=-O2 additional_flags=-gdwarf-5
 } else {
     require is_x86_64_m64_target
 }
 
+# Make .c available on the host.
+if [is_remote host] {
+    gdb_remote_download host $srcdir/$subdir/$srcfile2
+}
+
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
     return -1
 }
@@ -32,8 +37,7 @@ if ![runto_main] {
     return -1
 }
 
-set srcfile $srcfile2
-gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_breakpoint [gdb_get_line_number "break-here" $srcfile2]
 
 with_test_prefix "call 1" {
     gdb_continue_to_breakpoint "break-here" ".* break-here .*"
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
index da1445f51c2..504c534d654 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
@@ -18,12 +18,17 @@ set opts {}
 
 if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param.exp COMPILE=1"
-    set srcfile ${srcfile2}
+    standard_testfile .c .c
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
 }
 
+# Make .c available on the host.
+if [is_remote host] {
+    remote_download host $srcdir/$subdir/$srcfile2
+}
+
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
     return -1
 }
@@ -32,8 +37,7 @@ if ![runto_main] {
     return -1
 }
 
-set srcfile $srcfile2
-gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_breakpoint [gdb_get_line_number "break-here" $srcfile2]
 
 with_test_prefix "call 1" {
     gdb_continue_to_breakpoint "break-here" ".* break-here .*"
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
index ff3e0242e9a..4b4f507dd82 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
@@ -17,6 +17,11 @@ standard_testfile .S .cc
 
 require is_x86_64_m64_target
 
+# Make .cc available on the host.
+if [is_remote host] {
+    gdb_remote_download host $srcdir/$subdir/$srcfile2
+}
+
 if { [prepare_for_testing_full "failed to prepare" \
 	  [list $testfile "c++" $srcfile {}]] } {
     return -1
@@ -26,8 +31,7 @@ if ![runto_main] {
     return -1
 }
 
-set srcfile $srcfile2
-gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_breakpoint [gdb_get_line_number "break-here" $srcfile2]
 
 gdb_continue_to_breakpoint "break-here" ".* break-here .*"
 gdb_test "frame" {bar \(ref=@0x[0-9a-f]+: 10, ref@entry=@0x[0-9a-f]+: <optimized out>\) at .*}
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
index 1602aff5dc5..5ba435e5e72 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
@@ -14,16 +14,21 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 set opts {}
-standard_testfile .S
+standard_testfile .S .c
 
 if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-ret.exp COMPILE=1"
-    standard_testfile
+    standard_testfile .c .c
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
 }
 
+# Make .c available on the host.
+if [is_remote host] {
+    gdb_remote_download host $srcdir/$subdir/$srcfile2
+}
+
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
     return -1
 }
-- 
2.35.3


  reply	other threads:[~2023-03-15 15:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 15:38 [pushed 0/5] [gdb/testsuite] Fix remote host issues in gdb.arch tests Tom de Vries
2023-03-15 15:38 ` Tom de Vries [this message]
2023-03-15 15:38 ` [pushed 2/5] [gdb/testsuite] Unset DEBUGINFOD_URLS on remote host Tom de Vries
2023-03-15 15:38 ` [pushed 3/5] [gdb/testsuite] Fix gdb.arch/i386-pkru.exp for native-gdbserver Tom de Vries
2023-03-15 15:38 ` [pushed 4/5] [gdb/testsuite] Fix gdb.arch/amd64-stap-special-operands.exp for remote host Tom de Vries
2023-03-15 15:38 ` [pushed 5/5] [gdb/testsuite] Fix re-used exec in gdb.arch/ftrace-insn-reloc.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=20230315153837.21440-2-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).