From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 8537C3858C52 for ; Thu, 28 Sep 2023 18:32:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8537C3858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695925957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5tEPBYikOo7Cs6D5Og5/mhISy7qPYuWP3FMj74zaiJQ=; b=ZEjfpaNG6Av9x0IDnPoEpd6eIG7d4cnwVBcbiY57lPGXdJmmQ1708D3OU7Avm7vp01T6Xa szKmmhjO0ElXQCdtuGm57VmVwJ3Dwzbo/gYjemEaEKHyKaTS5u5BBjUbkVb1Swe0VGNhkE nCrW266zvpRww9JJV7o1ZkZY37YkO8I= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-ky54cSx7O6ChRawACPnf3A-1; Thu, 28 Sep 2023 14:32:36 -0400 X-MC-Unique: ky54cSx7O6ChRawACPnf3A-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9a621359127so1139688966b.0 for ; Thu, 28 Sep 2023 11:32:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695925955; x=1696530755; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5tEPBYikOo7Cs6D5Og5/mhISy7qPYuWP3FMj74zaiJQ=; b=TRWqtOlkjquiwIUJOEK6006pb5uOpbqDQhOG94hFvW0scksls/GOjBMb7mdecrTpW1 ygZtza2ixdDucxd6mig0GAstSA2EkVIAdATvRcI5q7zBJMqZeyWyO6rJ9/GBJquTgywZ eFP0JcJesZSXphfptcvpHJy4rTKle3Ya9zDK8T0zc6XYWRxqsD312F36Z4d/EHZ3m/2S 6Iy3R2WaRhXqlOCYIjxFwMsIUJVAHvvygqrHXDh8j80jJa3SHlunc27eGY0fUvAJZ38V rANbSKrzPQAHGwSN5emUa56/cljEi8Usyxu6pEsH04GmX2wdTXnh6bCmqt9LTa0CfPIP 8tQA== X-Gm-Message-State: AOJu0YyQid2VyF+sS8JoFGoAvK0GuHm1PllRFMIqd7ufbiNmxgU463ZA wXvDnBHbfQzMP/VAlxAFZZE1LzxbxQ1kqiD/YYIRQCmXJoigcOk72GsC224aSSQ/IJIQDkRtrHk 6MHgYDFmNfstK/P/YmxrgFQ== X-Received: by 2002:a17:906:ce:b0:9b2:be5e:7545 with SMTP id 14-20020a17090600ce00b009b2be5e7545mr1987841eji.36.1695925955150; Thu, 28 Sep 2023 11:32:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1AlMXiPU7SSV59lCgwinQADBhL2KBWZPbVbIas+T0hC+ZjuI6QW57ffCXTLEjE7Qki58QzA== X-Received: by 2002:a17:906:ce:b0:9b2:be5e:7545 with SMTP id 14-20020a17090600ce00b009b2be5e7545mr1987824eji.36.1695925954765; Thu, 28 Sep 2023 11:32:34 -0700 (PDT) Received: from localhost (92.40.218.138.threembb.co.uk. [92.40.218.138]) by smtp.gmail.com with ESMTPSA id z10-20020a170906714a00b0098ce63e36e9sm11380889ejj.16.2023.09.28.11.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 11:32:34 -0700 (PDT) From: Andrew Burgess To: Aaron Merey , gdb-patches@sourceware.org Cc: Aaron Merey , Eli Zaretskii Subject: Re: [PATCH 3/7 v3] gdb: Add command 'maint set/show debuginfod download-sections' In-Reply-To: <20230816044259.2675531-4-amerey@redhat.com> References: <20230816044259.2675531-1-amerey@redhat.com> <20230816044259.2675531-4-amerey@redhat.com> Date: Thu, 28 Sep 2023 19:32:33 +0100 Message-ID: <87v8buup1a.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Aaron Merey 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 > Reviewed-By: Andrew Burgess LGTM. Approved-By: Andrew Burgess 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