static cmd_list_element *set_debuginfod_prefix_list;
static cmd_list_element *show_debuginfod_prefix_list;
+/* maint set/show debuginfod commands. */
+static cmd_list_element *maint_set_debuginfod_cmdlist;
+static cmd_list_element *maint_show_debuginfod_cmdlist;
+
static const char debuginfod_on[] = "on";
static const char debuginfod_off[] = "off";
static const char debuginfod_ask[] = "ask";
debuginfod_off;
#endif
+/* Controls whether ELF/DWARF section downloading is enabled. */
+static bool debuginfod_download_sections =
+#if defined(HAVE_LIBDEBUGINFOD_FIND_SECTION)
+ true;
+#else
+ false;
+#endif
+
static unsigned int debuginfod_verbose = 1;
#ifndef HAVE_LIBDEBUGINFOD
return scoped_fd (-ENOSYS);
#else
- if (!debuginfod_is_enabled ())
+ if (!debuginfod_download_sections || !debuginfod_is_enabled ())
return scoped_fd (-ENOSYS);
debuginfod_client *c = get_debuginfod_client ();
value);
}
+/* Set callback for "maint set debuginfod download-sections". */
+
+static void
+maint_set_debuginfod_download_sections (bool value)
+{
+#if !defined(HAVE_LIBDEBUGINFOD_FIND_SECTION)
+ if (value)
+ error (_("Support for section downloading is not compiled into GDB. " \
+"Defaulting to \"off\"."));
+#endif
+
+ debuginfod_download_sections = value;
+}
+
+/* Get callback for "maint set debuginfod download-sections". */
+
+static bool
+maint_get_debuginfod_download_sections ()
+{
+ return debuginfod_download_sections;
+}
+
/* Register debuginfod commands. */
void _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. GDB may also download components of debug\n\
+info instead of entire files. \"off\" disables the use of debuginfod.\n\
+When set to \"ask\", prompt whether to enable or disable debuginfod." ),
set_debuginfod_enabled,
get_debuginfod_enabled,
show_debuginfod_enabled,
show_debuginfod_verbose_command,
&set_debuginfod_prefix_list,
&show_debuginfod_prefix_list);
+
+ /* maint set/show debuginfod. */
+ add_setshow_prefix_cmd ("debuginfod", class_maintenance,
+ _("Set debuginfod specific variables."),
+ _("Show debuginfod specific variables."),
+ &maint_set_debuginfod_cmdlist,
+ &maint_show_debuginfod_cmdlist,
+ &maintenance_set_cmdlist, &maintenance_show_cmdlist);
+
+ /* maint set/show debuginfod download-sections. */
+ add_setshow_boolean_cmd ("download-sections", class_maintenance, _("\
+Set whether debuginfod may download individual ELF/DWARF sections."), _("\
+Show whether debuginfod may download individual ELF/DWARF sections."), _("\
+When enabled, debuginfod may attempt to download individual ELF/DWARF \
+sections from debug info files.\nIf disabled, only whole debug info files \
+may be downloaded."),
+ maint_set_debuginfod_download_sections,
+ maint_get_debuginfod_download_sections,
+ nullptr,
+ &maint_set_debuginfod_cmdlist,
+ &maint_show_debuginfod_cmdlist);
}
(@value{GDBP})
@end smallexample
+@kindex maint set debuginfod download-sections
+@kindex maint show debuginfod download-sections
+@cindex debuginfod, maintenance commands
+@item maint set debuginfod download-sections
+@itemx maint set debuginfod download-sections @r{[}on|off@r{]}
+@itemx maint show debuginfod download-sections
+Controls whether @value{GDBN} will attempt to download individual
+ELF/DWARF sections from @code{debuginfod}. If disabled, only
+whole debug info files will be downloaded; this could result
+in @value{GDBN} downloading larger amounts of data.
+
@cindex @value{GDBN} internal error
@cindex internal errors, control of @value{GDBN} behavior
@cindex demangler crashes
@item set debuginfod enabled
@itemx set debuginfod enabled on
@cindex enable debuginfod
-@value{GDBN} will attempt to query @code{debuginfod} servers when missing debug
-info or source files.
+@value{GDBN} may query @code{debuginfod} servers for missing debug info and
+source files. @value{GDBN} may also download individual ELF/DWARF sections
+such as @code{.gdb_index} to help reduce the total amount of data downloaded
+from @code{debuginfod} servers; this can be controlled by @w{@code{maint
+set debuginfod download-sections}} (@pxref{Maintenance Commands, maint set
+debuginfod download-sections}).
@item set debuginfod enabled off
@value{GDBN} will not attempt to query @code{debuginfod} servers when missing