Currently debuginfod is disabled when the string of server URLs
is unset or set to be the empty string (via the $DEBUGINFOD_URLS
environment variable or the 'set debuginfod urls' gdb command).
Extend this functionality so that a whitespace-only URL also disables
debuginfod.
Modify a testcase to verify that a whitespace-only URL disables
debuginfod.
static bool
debuginfod_is_enabled ()
{
- const char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
+ const char *urls = skip_spaces (getenv (DEBUGINFOD_URLS_ENV_VAR));
- if (urls == nullptr || urls[0] == '\0'
- || debuginfod_enabled == debuginfod_off)
+ if (debuginfod_enabled == debuginfod_off
+ || urls == nullptr
+ || *urls == '\0')
return false;
if (debuginfod_enabled == debuginfod_ask)
clean_restart
# Disable confirmation to avoid having to deal with a query. See
# test_urls.
- gdb_test_multiple "with confirm off -- file $binfile" "notice empty URL" {
+ set file_cmd "with confirm off -- file $binfile"
+ gdb_test_multiple $file_cmd "notice empty URL" {
-re -wrap "This GDB supports auto-downloading.*" {
fail $gdb_test_name
}
}
}
- test_urls " " \
- "" \
- "notice whitespace URL"
+ # Whitespace-only URLS disables Debuginfod.
+ setenv DEBUGINFOD_URLS " "
+ clean_restart
+ gdb_test_multiple $file_cmd "notice whitespace URL" {
+ -re -wrap "This GDB supports auto-downloading.*" {
+ fail $gdb_test_name
+ }
+ -re -wrap "" {
+ pass $gdb_test_name
+ }
+ }
set url "http://127.0.0.1:$port"