From: Tom de Vries Date: Wed, 15 Mar 2023 15:38:03 +0000 (+0100) Subject: [gdb/testsuite] Unset DEBUGINFOD_URLS on remote host X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86091eae202f32acee55afdb6134e7f4efa20209;p=binutils-gdb.git [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 ^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. --- 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