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 2/5] [gdb/testsuite] Unset DEBUGINFOD_URLS on remote host
Date: Wed, 15 Mar 2023 16:38:34 +0100	[thread overview]
Message-ID: <20230315153837.21440-3-tdevries@suse.de> (raw)
In-Reply-To: <20230315153837.21440-1-tdevries@suse.de>

When running test-case gdb.arch/i386-pkru.exp with host board
local-remote-host-notty and target board native-gdbserver on openSUSE
Tumbleweed (with DEBUGINFOD_URLS set), I run into:
...
This GDB supports auto-downloading debuginfo from the following URLs:^M
  <https://debuginfod.opensuse.org/>^M
Enable debuginfod for this session? (y or [n]) ^CQuit^M
(gdb) FAIL: gdb.arch/i386-pkru.exp: runto: run to main
...

The problem is that the unsetenv for DEBUGINFOD_URLS in default_gdb_init:
...
    # If DEBUGINFOD_URLS is set, gdb will try to download sources and
    # debug info for f.i. system libraries.  Prevent this.
    unset -nocomplain ::env(DEBUGINFOD_URLS)
...
doesn't work on remote host.

Fix this by using "set debuginfod enabled off" for remote host.

Tested on x86_64-linux.
---
 gdb/testsuite/lib/gdb.exp | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 23277c4ab79..8b3a594e6a4 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -219,6 +219,17 @@ if ![info exists INTERNAL_GDBFLAGS] {
 		   {-iex "set height 0"} \
 		   {-iex "set width 0"}]]
 
+    # If DEBUGINFOD_URLS is set, gdb will try to download sources and
+    # debug info for f.i. system libraries.  Prevent this.
+    if { [is_remote host] } {
+	# Setting environment variables on build has no effect on remote host,
+	# so handle this using "set debuginfod enabled off" instead.
+	set INTERNAL_GDBFLAGS \
+	    "$INTERNAL_GDBFLAGS -iex \"set debuginfod enabled off\""
+    } else {
+	# See default_gdb_init.
+    }
+
     set INTERNAL_GDBFLAGS [append_gdb_data_directory_option $INTERNAL_GDBFLAGS]
 }
 
@@ -6173,7 +6184,14 @@ proc default_gdb_init { test_file_name } {
 
     # If DEBUGINFOD_URLS is set, gdb will try to download sources and
     # debug info for f.i. system libraries.  Prevent this.
-    unset -nocomplain ::env(DEBUGINFOD_URLS)
+    if { [is_remote host] } {
+	# See initialization of INTERNAL_GDBFLAGS.
+    } else {
+	# Using "set debuginfod enabled off" in INTERNAL_GDBFLAGS interferes
+	# with the gdb.debuginfod test-cases, so use the unsetenv method for
+	# non-remote host.
+	unset -nocomplain ::env(DEBUGINFOD_URLS)
+    }
 
     # Ensure that GDBHISTFILE and GDBHISTSIZE are removed from the
     # environment, we don't want these modifications to the history
-- 
2.35.3


  parent 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 ` [pushed 1/5] [gdb/testsuite] Fix gdb.arch/amd64*.exp with local-remote-host-native.exp Tom de Vries
2023-03-15 15:38 ` Tom de Vries [this message]
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-3-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).