From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id aa4iISmdtWkKYCkAWB0awg (envelope-from ) for ; Sat, 14 Mar 2026 13:38:49 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=eQFZ/NPG; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=8Ozf+kA+; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=L5++sp7Y; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Oy652jUl; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 815371E0DD; Sat, 14 Mar 2026 13:38:49 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DCD141E089 for ; Sat, 14 Mar 2026 13:38:48 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 63D014B0A6E9 for ; Sat, 14 Mar 2026 17:38:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63D014B0A6E9 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=eQFZ/NPG; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=8Ozf+kA+; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=L5++sp7Y; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Oy652jUl Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id D58D24BAE7F8 for ; Sat, 14 Mar 2026 17:37:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D58D24BAE7F8 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D58D24BAE7F8 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773509859; cv=none; b=aFBzH8EF5BzS29b90R9QMpMpU/6FOSmzcJAwIIJNBTLtinEOJsHzy8Tp2oLW6QQrErqw2IyMcpML+uUww3tR03XNGjak3bxwrYRVrRSAjO5CXZOC0tUHxsSoBa3sk6Gqw1fZt2kYMG9HzN1t2BnBfaayb0hTUrZEZOiHt2drFaY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773509859; c=relaxed/simple; bh=FYx0SsaSCNxbJeGuYJBLiCt0M0vI9Km1oqKKNbwx5QY=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=r8q/9WAjR/lr0iIkKt/F+yLbY2NjSOHvQvOL0shPOWvOGJQusw6iRNu/WFBM43Ogr3Y9i1dLkjEVuQcAQGKKOBWB1eSJgVnb/kwou3mNWZIfu5H4SJc24VHJT7yISIwHINo5tB+Wi6HaBpkwNq5NZFZwTZSTjLVKYH+6CGkSURs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D58D24BAE7F8 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id F10FC4D21E for ; Sat, 14 Mar 2026 17:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773509858; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o1LnPTh1YPull4jZTBBkqxwwnGxG/OlFSO8jMQSIZiQ=; b=eQFZ/NPGIWSiJ5+j+l0GTeQEYLbSO5Z+KiSpTcpo9YFuZmrRfyA2T6u11FRD2z+FkX/DhP +fqQt19caA0IpqsLinHHnW1pNW4Km3xXblKvOo/Xhaog+5fUzomVTUvX0FE8oGoZyd7/IQ Nmk/yejJaVsltoPR0IVBMoRHcJhafGU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773509858; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o1LnPTh1YPull4jZTBBkqxwwnGxG/OlFSO8jMQSIZiQ=; b=8Ozf+kA+SrqYebWXiPokZFTtDCLOBTL/DZgm8VDFAqQiHsHEkCiMcTkoGrNK3rrmXJ60LZ CDfmM2ee7xptp7DA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773509857; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o1LnPTh1YPull4jZTBBkqxwwnGxG/OlFSO8jMQSIZiQ=; b=L5++sp7YB6jFoT+KLVXXD6blJqox8pbxa3rxoAz8IV105LmzNExT2TFQOi3uNym/Q4zf46 5558O8/cfypIoT6RpdZ3BbrEveDze8mAp/GtEA5boh0pUiPc+0tN/BtTsXFfjWqFw5OHek ca18sQg5PB2+GHnUlcLz1xmyAXpOxQY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773509857; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o1LnPTh1YPull4jZTBBkqxwwnGxG/OlFSO8jMQSIZiQ=; b=Oy652jUl203hHdPcjW4rKDJtY3rQTqukn/GKJCrKZttxccP3RS50nmtKVSlrE99HSiM2ng k5uXNoqdeBNFPFCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D527E42726 for ; Sat, 14 Mar 2026 17:37:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2EOiMuGctWnNeQAAD6G6ig (envelope-from ) for ; Sat, 14 Mar 2026 17:37:37 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v5 2/4] [gdb] Add debuginfod_enabled_ask_p Date: Sat, 14 Mar 2026 18:37:35 +0100 Message-ID: <20260314173737.1436116-3-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260314173737.1436116-1-tdevries@suse.de> References: <20260314173737.1436116-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Factor out debuginfod_is_enabled_1 out of debuginfod_is_enabled, and use it to implement debuginfod_enabled_ask_p. --- gdb/debuginfod-support.c | 40 +++++++++++++++++++++++++++++++--------- gdb/debuginfod-support.h | 5 +++++ 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c index ca4a5b1a7af..9751cd64319 100644 --- a/gdb/debuginfod-support.c +++ b/gdb/debuginfod-support.c @@ -224,20 +224,20 @@ get_debuginfod_client () return global_client; } -/* Check if debuginfod is enabled. If configured to do so, ask the user - whether to enable debuginfod. */ +/* Check if debuginfod is enabled. If configured to do so and ALLOW_ASK, ask + the user whether to enable debuginfod. */ -static bool -debuginfod_is_enabled () +static const char * +debuginfod_is_enabled_1 (bool allow_ask) { const char *urls = skip_spaces (getenv (DEBUGINFOD_URLS_ENV_VAR)); if (urls == nullptr || *urls == '\0') - return false; + return debuginfod_off; - if (debuginfod_enabled != debuginfod_ask) - return debuginfod_enabled == debuginfod_on; + if (debuginfod_enabled != debuginfod_ask || !allow_ask) + return debuginfod_enabled; gdb_printf (_("\nThis GDB supports auto-downloading debuginfo " \ "from the following URLs:\n")); @@ -282,8 +282,18 @@ debuginfod_is_enabled () debuginfod_enabled = debuginfod_on; } - gdb_assert (debuginfod_enabled != debuginfod_ask); - return debuginfod_enabled == debuginfod_on; + return debuginfod_enabled; +} + +/* Check if debuginfod is enabled. If configured to do so, ask the user + whether to enable debuginfod. */ + +static bool +debuginfod_is_enabled () +{ + const char *res = debuginfod_is_enabled_1 (true); + gdb_assert (res != debuginfod_ask); + return res == debuginfod_on; } /* Print the result of the most recent attempted download. */ @@ -486,6 +496,18 @@ debuginfod_section_query (const unsigned char *build_id, #endif +/* See debuginfod-support.h. */ + +bool +debuginfod_enabled_ask_p () +{ +#if defined(HAVE_LIBDEBUGINFOD) + return debuginfod_is_enabled_1 (false) == debuginfod_ask; +#else + return false; +#endif +} + /* Set callback for "set debuginfod enabled". */ static void diff --git a/gdb/debuginfod-support.h b/gdb/debuginfod-support.h index cc5bf331812..7e7b5965c3b 100644 --- a/gdb/debuginfod-support.h +++ b/gdb/debuginfod-support.h @@ -105,4 +105,9 @@ extern scoped_fd debuginfod_section_query (const unsigned char *build_id, const char *section_name, gdb::unique_xmalloc_ptr *destname); + +/* Check if debuginfod enabled is set to ask. */ + +extern bool debuginfod_enabled_ask_p (); + #endif /* GDB_DEBUGINFOD_SUPPORT_H */ -- 2.51.0