public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Aaron Merey <amerey@redhat.com>, gdb-patches@sourceware.org
Cc: Aaron Merey <amerey@redhat.com>, Eli Zaretskii <eliz@gnu.org>
Subject: Re: [PATCH 3/7 v3] gdb: Add command 'maint set/show debuginfod download-sections'
Date: Thu, 28 Sep 2023 19:32:33 +0100	[thread overview]
Message-ID: <87v8buup1a.fsf@redhat.com> (raw)
In-Reply-To: <20230816044259.2675531-4-amerey@redhat.com>

Aaron Merey <amerey@redhat.com> writes:

> v2: https://sourceware.org/pipermail/gdb-patches/2023-June/199983.html
>
> v3 updates some of the doc text.
>
> Commit message:
>
> This setting controls whether GDB may attempt to download ELF/DWARF
> sections from debuginfod servers.
>
> This setting is enabled by default if gdb is built with debuginfod
> section download support (requires libdebuginfod 0.188).
>
> Also update debuginfod command help text and gdb.texinfo with
> information on section downloading and the new command.
>
> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
> Reviewed-By: Andrew Burgess <aburgess@redhat.com>

LGTM.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew


> ---
>  gdb/debuginfod-support.c | 63 ++++++++++++++++++++++++++++++++++++++--
>  gdb/doc/gdb.texinfo      | 19 ++++++++++--
>  2 files changed, 77 insertions(+), 5 deletions(-)
>
> diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
> index 33bb9d9b7bc..c0794212a31 100644
> --- a/gdb/debuginfod-support.c
> +++ b/gdb/debuginfod-support.c
> @@ -31,6 +31,10 @@
>  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";
> @@ -50,6 +54,14 @@ static const char *debuginfod_enabled =
>    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
> @@ -435,7 +447,7 @@ debuginfod_section_query (const unsigned char *build_id,
>    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 ();
> @@ -561,6 +573,28 @@ show_debuginfod_verbose_command (ui_file *file, int from_tty,
>  	      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 ();
> @@ -579,8 +613,10 @@ _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,
> @@ -611,4 +647,25 @@ query.\nTo disable, set to zero.  Verbose output is displayed by default."),
>  			     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);
>  }
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 814cc6d714a..7ecf07e2820 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -40920,6 +40920,17 @@ Create a core file? (y or n) @kbd{n}
>  (@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
> @@ -49430,8 +49441,12 @@ regarding @code{debuginfod}.
>  @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
> -- 
> 2.41.0


  parent reply	other threads:[~2023-09-28 18:32 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16  4:42 [PATCH 0/7] gdb/debuginfod: Add on-demand debuginfo downloading Aaron Merey
2023-08-16  4:42 ` [PATCH 1/7] config/debuginfod.m4: Add check for libdebuginfod 0.188 Aaron Merey
2023-09-19 14:33   ` Aaron Merey
2023-09-27 10:28     ` Nick Clifton
2023-09-27 19:14       ` Aaron Merey
2023-08-16  4:42 ` [PATCH 2/7 v3] gdb/debuginfod: Add debuginfod_section_query Aaron Merey
2023-09-19 14:33   ` Aaron Merey
2023-09-28 18:28   ` Andrew Burgess
2023-10-02 18:07     ` Aaron Merey
2023-08-16  4:42 ` [PATCH 3/7 v3] gdb: Add command 'maint set/show debuginfod download-sections' Aaron Merey
2023-08-16 12:45   ` Eli Zaretskii
2023-09-19 14:34     ` Aaron Merey
2023-09-28 18:32   ` Andrew Burgess [this message]
2023-10-02 18:08     ` Aaron Merey
2023-08-16  4:42 ` [PATCH 4/7 v5] gdb: Buffer output streams during events that might download debuginfo Aaron Merey
2023-09-19 14:34   ` Aaron Merey
2023-10-10 21:55   ` [PATCH v6] " Aaron Merey
2023-10-24 11:22     ` Andrew Burgess
2023-10-28  0:25       ` Aaron Merey
2023-08-16  4:42 ` [PATCH 5/7 v2] gdb/progspace: Add reverse safe iterator and template for unwrapping iterator Aaron Merey
2023-09-19 14:35   ` Aaron Merey
2023-10-10 21:56     ` [PING*2][PATCH " Aaron Merey
2023-08-16  4:42 ` [PATCH 6/7 v4] gdb/debuginfod: Support on-demand debuginfo downloading Aaron Merey
2023-09-19 14:35   ` Aaron Merey
2023-10-10 21:57     ` [PING*2][PATCH " Aaron Merey
2023-08-16  4:42 ` [PATCH 7/7 v4] gdb/debuginfod: Add .debug_line downloading Aaron Merey
2023-09-19 14:35   ` Aaron Merey
2023-10-10 21:58     ` [PING*2][PATCH " Aaron Merey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8buup1a.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=amerey@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).