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 78D463858C39 for ; Wed, 6 Jul 2022 19:14:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 78D463858C39 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-595-jqKWCH8mPF6fcWL-RtZ0NQ-1; Wed, 06 Jul 2022 15:14:14 -0400 X-MC-Unique: jqKWCH8mPF6fcWL-RtZ0NQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B3C61801590; Wed, 6 Jul 2022 19:14:13 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.9.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 779661121315; Wed, 6 Jul 2022 19:14:13 +0000 (UTC) From: Aaron Merey To: lsix@lancelotsix.com Cc: gdb-patches@sourceware.org, Aaron Merey Subject: [PATCH] [PR gdb/29316] gdb-add-index always generates an error when libdebuginfod wasn't compiled in Date: Wed, 6 Jul 2022 15:14:02 -0400 Message-Id: <20220706191402.55765-1-amerey@redhat.com> In-Reply-To: <20220706103242.xexrlcuctwbl3izp@ubuntu.lan> References: <20220706103242.xexrlcuctwbl3izp@ubuntu.lan> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 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_LOW, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2022 19:14:22 -0000 On Wed, Jul 6, 2022 at 6:41 AM Lancelot SIX wrote: > > On Tue, Jul 05, 2022 at 06:37:11PM -0400, Aaron Merey via Gdb-patches wrote: > > -  error (NO_IMPL); > > +  /* Disabling debuginfod when gdb is not built with it is a no-op.  */ > > +  if (strcmp (value, debuginfod_off) != 0) > > +    error (NO_IMPL); > > You could compare the pointers themselves instead of doing a strcmp. > The call to parse_cli_var_enum earlier in the processing ensures that > VALUE is a member of debuginfod_enabled_enum. Thanks Lancelot, I've updated the patch below. Aaron --- gdb-add-index runs gdb with -iex 'set debuginfod enabled off'. If gdb is not compiled against libdebuginfod this causes an unnecessary error message to be printed to stderr indicating that gdb was not built with debuginfod support. Fix this by changing the 'set debuginfod enabled off' command to a no-op when gdb isn't built with libdebuginfod. --- gdb/debuginfod-support.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c index 9dbe6b5d8b2..5f04a2b38ca 100644 --- a/gdb/debuginfod-support.c +++ b/gdb/debuginfod-support.c @@ -368,7 +368,9 @@ set_debuginfod_enabled (const char *value) #if defined(HAVE_LIBDEBUGINFOD) debuginfod_enabled = value; #else - error (NO_IMPL); + /* Disabling debuginfod when gdb is not built with it is a no-op. */ + if (value != debuginfod_off) + error (NO_IMPL); #endif } -- 2.35.3