Skip to content

Commit 86091ea

Browse files
committed
[gdb/testsuite] Unset DEBUGINFOD_URLS on remote host
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.
1 parent 81a7a72 commit 86091ea

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

gdb/testsuite/lib/gdb.exp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,17 @@ if ![info exists INTERNAL_GDBFLAGS] {
219219
{-iex "set height 0"} \
220220
{-iex "set width 0"}]]
221221

222+
# If DEBUGINFOD_URLS is set, gdb will try to download sources and
223+
# debug info for f.i. system libraries. Prevent this.
224+
if { [is_remote host] } {
225+
# Setting environment variables on build has no effect on remote host,
226+
# so handle this using "set debuginfod enabled off" instead.
227+
set INTERNAL_GDBFLAGS \
228+
"$INTERNAL_GDBFLAGS -iex \"set debuginfod enabled off\""
229+
} else {
230+
# See default_gdb_init.
231+
}
232+
222233
set INTERNAL_GDBFLAGS [append_gdb_data_directory_option $INTERNAL_GDBFLAGS]
223234
}
224235

@@ -6173,7 +6184,14 @@ proc default_gdb_init { test_file_name } {
61736184

61746185
# If DEBUGINFOD_URLS is set, gdb will try to download sources and
61756186
# debug info for f.i. system libraries. Prevent this.
6176-
unset -nocomplain ::env(DEBUGINFOD_URLS)
6187+
if { [is_remote host] } {
6188+
# See initialization of INTERNAL_GDBFLAGS.
6189+
} else {
6190+
# Using "set debuginfod enabled off" in INTERNAL_GDBFLAGS interferes
6191+
# with the gdb.debuginfod test-cases, so use the unsetenv method for
6192+
# non-remote host.
6193+
unset -nocomplain ::env(DEBUGINFOD_URLS)
6194+
}
61776195

61786196
# Ensure that GDBHISTFILE and GDBHISTSIZE are removed from the
61796197
# environment, we don't want these modifications to the history

0 commit comments

Comments
 (0)