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 71ED23858296 for ; Wed, 7 Jun 2023 15:35:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 71ED23858296 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=1686152108; 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=NnjQ02F+P1EntdtTuUAjSxX49o0HHVQY2TZLfkY5ICg=; b=SkKDNkiFgIre7hnRWFhY7CPFa4up7WD0fkjhw9EdWd9bHanTJwTX45+DQRz8nF8ycM7TNm 8eueXkMsvegtezcjCryEm3LkvyYfVMlUA+nc9FsCj4GApU1HNAvfbFDnZNYZNnaDQPb+Tu C/CSJwpZM1hgM6oY402HUllnZGyMVEk= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-277-CEJh0weHMkCNyQtH6u5Miw-1; Wed, 07 Jun 2023 09:57:39 -0400 X-MC-Unique: CEJh0weHMkCNyQtH6u5Miw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3f7eb414fcbso8281985e9.2 for ; Wed, 07 Jun 2023 06:57:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686146258; x=1688738258; 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=NnjQ02F+P1EntdtTuUAjSxX49o0HHVQY2TZLfkY5ICg=; b=c38bKGfEwpjJBGRcyiH9E30Qzpw2gshuL1KVN2G2CSoVHHMqiqS3dh92s7mpm/cIC5 SnPBmRM20BwdM8XtY3gFd+3LxwaP7cSHeno+7rMy6xqQiBJK1RzdMm4ftm0U7WtQU84V 47j76n2HO4F8SDLjTSmBWbRB8kyFlWfralq08eCinh+BJqpJshlBq8mPvZMuih+OP+P+ neLODN5MsH0BFG/2fmCXVy4qWBJ2owjz/OKTAoBkWdNv2aS9JcDo07Y/aWGd5RZ5hXXi mgEOTLegCBrQx4us5s/SEpNp2A8jbhvpcO2vBx2vtgw2XQQsnqpUnDyBCLlhJawxeMMA yQEw== X-Gm-Message-State: AC+VfDwRuQVCT5OlMhdK1vsOjpyVhcxJM1qoB+IHsfLgTS+LYMp2YliJ dcM7uv54hUy5I8NP118bvbJDKHeONLbn75HOY0krGqzLGqhO5/a0QOOdrwGieMZilSamcEvGUYT JzIptjxOzgqLC4lETLB/IMtWd7culbg== X-Received: by 2002:a05:600c:2181:b0:3f7:2a13:9621 with SMTP id e1-20020a05600c218100b003f72a139621mr4276873wme.40.1686146258254; Wed, 07 Jun 2023 06:57:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4TR407EHC8qqwge+tjgbSlcupFIa4tnkwgE2UHKdpN4P8rebTMlpHDyHwiDnigg4+wdpNcjQ== X-Received: by 2002:a05:600c:2181:b0:3f7:2a13:9621 with SMTP id e1-20020a05600c218100b003f72a139621mr4276860wme.40.1686146257941; Wed, 07 Jun 2023 06:57:37 -0700 (PDT) Received: from localhost (11.72.115.87.dyn.plus.net. [87.115.72.11]) by smtp.gmail.com with ESMTPSA id z17-20020a1c4c11000000b003f60a9ccd34sm2244776wmf.37.2023.06.07.06.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 06:57:37 -0700 (PDT) From: Andrew Burgess To: Aaron Merey , gdb-patches@sourceware.org Cc: Aaron Merey Subject: Re: [PATCH 2/6 v2] gdb: Add command 'maint set/show debuginfod download-sections' In-Reply-To: <20230601014347.3367489-3-amerey@redhat.com> References: <20230601014347.3367489-1-amerey@redhat.com> <20230601014347.3367489-3-amerey@redhat.com> Date: Wed, 07 Jun 2023 14:57:36 +0100 Message-ID: <87ttvj1ijz.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=-11.8 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,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: > v1: https://sourceware.org/pipermail/gdb-patches/2023-February/197461.html > > v2 removes 'set debuginfod enabled lazy' and replaces it with > 'maint set debuginfod download-sections'. > > 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. > --- > gdb/debuginfod-support.c | 66 ++++++++++++++++++++++++++++++++++++++-- > gdb/doc/gdb.texinfo | 16 ++++++++-- > 2 files changed, 77 insertions(+), 5 deletions(-) > > diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c > index 8be43a91dcc..6d0521b64e2 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,13 @@ static const char *debuginfod_enabled = > debuginfod_off; > #endif > > +static bool debuginfod_download_sections = Should have a comment. > +#if defined(HAVE_LIBDEBUGINFOD_FIND_SECTION) > + true; > +#else > + false; > +#endif > + > static unsigned int debuginfod_verbose = 1; > > #ifndef HAVE_LIBDEBUGINFOD > @@ -424,7 +435,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 (); > @@ -550,6 +561,31 @@ 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\".")); > + return; > + } You can drop the return here, error is marked noreturn. With that gone, you can remove the '{' and '}' too. > +#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 (); > @@ -568,8 +604,11 @@ _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\", a prompt may ask whether to enable or disable\n\ > +debuginfod." ), > set_debuginfod_enabled, > get_debuginfod_enabled, > show_debuginfod_enabled, > @@ -600,4 +639,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 */ This comment, and the one below, should end with a full stop and double space. > + 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); The indentation is off by one here. I think all the above are pretty minor. With those fixed this GDB code changes are good. Approved-By: Andrew Burgess Thanks, Andrew > } > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index fc55c4e7b43..91da9777fd6 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -40872,6 +40872,16 @@ Create a core file? (y or n) @kbd{n} > (@value{GDBP}) > @end smallexample > > +@kindex maint set debuginfod > +@kindex maint show debuginfod > +@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 > @@ -49382,8 +49392,10 @@ 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} will attempt to query @code{debuginfod} servers for missing debug > +info or source files. @value{GDBN} may attempt to download individual ELF/DWARF > +sections such as @code{.gdb_index} to help reduce the total amount of data > +downloaded from debuginfod servers. > > @item set debuginfod enabled off > @value{GDBN} will not attempt to query @code{debuginfod} servers when missing > -- > 2.40.1