]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: add 'lazy' setting for command 'set debuginfod enabled'
authorAaron Merey <amerey@redhat.com>
Mon, 27 Feb 2023 15:41:00 +0000 (10:41 -0500)
committerAaron Merey <amerey@redhat.com>
Tue, 23 May 2023 15:40:12 +0000 (11:40 -0400)
'set debuginfod enabled lazy' turns on debuginfod downloading like
'set debuginfod enabled on' but also enables ELF/DWARFs section
downloading via debuginfod_section_query.

If support for debuginfod section queries was not found at configure
time, 'set debuginfod enabled lazy' will print an error message
indicating the missing support and default to 'set debuginfod enabled on'.

Also update the help text and gdb.texinfo section for 'set debuginfod enabled'
with information on the lazy setting.

gdb/debuginfod-support.c
gdb/doc/gdb.texinfo

index 81a5f95e06455e9b0c23b75bb228e6f7d65e907a..fb96dbaced17a669ea431e38c8b0851935326e7d 100644 (file)
@@ -34,12 +34,14 @@ static cmd_list_element *show_debuginfod_prefix_list;
 static const char debuginfod_on[] = "on";
 static const char debuginfod_off[] = "off";
 static const char debuginfod_ask[] = "ask";
+static const char debuginfod_lazy[] = "lazy";
 
 static const char *debuginfod_enabled_enum[] =
 {
   debuginfod_on,
   debuginfod_off,
   debuginfod_ask,
+  debuginfod_lazy,
   nullptr
 };
 
@@ -424,7 +426,7 @@ debuginfod_section_query (const unsigned char *build_id,
   return scoped_fd (-ENOSYS);
 #else
 
- if (!debuginfod_is_enabled ())
+ if (debuginfod_enabled != debuginfod_lazy || !debuginfod_is_enabled ())
     return scoped_fd (-ENOSYS);
 
   debuginfod_client *c = get_debuginfod_client ();
@@ -468,6 +470,14 @@ static void
 set_debuginfod_enabled (const char *value)
 {
 #if defined(HAVE_LIBDEBUGINFOD)
+#if !defined(HAVE_DEBUGINFOD_FIND_SECTION)
+  if (value == debuginfod_lazy)
+    {
+      debuginfod_enabled = debuginfod_on;
+      error (_("Support for lazy downloading is not compiled into GDB. " \
+"Defaulting to \"on\"."));
+    }
+#endif
   debuginfod_enabled = value;
 #else
   /* Disabling debuginfod when gdb is not built with it is a no-op.  */
@@ -567,8 +577,12 @@ _initialize_debuginfod ()
                        _("Set whether to use debuginfod."),
                        _("Show whether to use debuginfod."),
                        _("\
-When on, enable the use of debuginfod to download missing debug info and\n\
-source files."),
+When set to \"on\", enable the use of debuginfod to download missing\n\
+debug info and source files. \"off\" disables the use of debuginfod.\n\
+When set to \"ask\", a prompt may ask whether to enable or disable\n\
+debuginfod.  When set to \"lazy\", debug info downloading will be\n\
+deferred until it is required. GDB may also download components of\n\
+debug info instead of entire files." ),
                        set_debuginfod_enabled,
                        get_debuginfod_enabled,
                        show_debuginfod_enabled,
index f23bcc5f3f803fe8d6cbacf9e7743e63cd6e5464..6c14c69bce13c7e7596d6748a4bcbae55327a3c3 100644 (file)
@@ -49332,10 +49332,15 @@ debug info or source files.  By default, @code{debuginfod enabled} is set to
 attempting to perform the next query.  By default, @code{debuginfod enabled}
 is set to @code{ask} for interactive sessions.
 
+@item set debuginfod enabled lazy
+@value{GDBN} will attempt to defer downloading entire debug info files until
+necessary. @value{GDBN} may instead download individual components of the
+debug info files such as @code{.gdb_index}.
+
 @kindex show debuginfod enabled
 @item show debuginfod enabled
-Display whether @code{debuginfod enabled} is set to @code{on}, @code{off} or
-@code{ask}.
+Display whether @code{debuginfod enabled} is set to @code{on}, @code{off},
+@code{ask} or @code{lazy}.
 
 @kindex set debuginfod urls
 @cindex configure debuginfod URLs