aboutsummaryrefslogtreecommitdiff
path: root/gdb/debuginfod-support.c
diff options
context:
space:
mode:
authorAaron Merey <amerey@redhat.com>2022-04-27 16:41:24 -0400
committerAaron Merey <amerey@redhat.com>2022-05-02 16:15:06 -0400
commit95929abb498786d9dce36bb94b6c3f1d63178956 (patch)
treed0401f4ea63126a7beb6c1a78bb976e29233e099 /gdb/debuginfod-support.c
parent03ada39ea590fec3bd722e9ea776049213da8b58 (diff)
downloadgdb-95929abb498786d9dce36bb94b6c3f1d63178956.zip
gdb-95929abb498786d9dce36bb94b6c3f1d63178956.tar.gz
gdb-95929abb498786d9dce36bb94b6c3f1d63178956.tar.bz2
gdb/debuginfod: Whitespace-only URL should disable debuginfod
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.
Diffstat (limited to 'gdb/debuginfod-support.c')
-rw-r--r--gdb/debuginfod-support.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index 4ce2e78..dffcd78 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -173,10 +173,11 @@ get_debuginfod_client ()
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)