From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YmkFIgPo4WkY2B0AWB0awg (envelope-from ) for ; Fri, 17 Apr 2026 03:57:55 -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=nokRLdBz; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=TCjjRFX5; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=nokRLdBz; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=TCjjRFX5; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5FF591E0C3; Fri, 17 Apr 2026 03:57:55 -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 744BA1E0B1 for ; Fri, 17 Apr 2026 03:57:53 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id BA5724BAD158 for ; Fri, 17 Apr 2026 07:57:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA5724BAD158 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=nokRLdBz; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=TCjjRFX5; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=nokRLdBz; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=TCjjRFX5 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 5CDF54BAD14A for ; Fri, 17 Apr 2026 07:57:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5CDF54BAD14A 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 5CDF54BAD14A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776412641; cv=none; b=hXexFWjIiBOauF7GEqEwKe2mi7LdEjKyP9PHBR2M/jGLXdREfziUyRVziBzI4rxBfSePeizEhZjYA8Fkif4noEt82r9yhlu52IhE2JmLe+RBDP3bhrYp4AxYb1JbgARkg8SyGGkUJECkaekxTvbrP6R4dW6XJ9DfIrXpqaJ9sG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776412641; c=relaxed/simple; bh=SKPM5RwOE/PibnXoSIeIY/o031bWpiwBIUBw1cKvfhc=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=YTZHckrkgRC0q2HhVkTpyltpT5NyBN0yKZpqnh0/qu5vdYMivqXvjgkKbht92SCXRwz7+k8o46F3ZB7dZvqUIVgVAOSoaPPjHPHPNPzX5UlEG+E6PWDKmf5AqnM5GdernMpbSWWvhOTu429LQIfP9mcL4ksk5ON8Uo9NY/07twA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CDF54BAD14A 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-out2.suse.de (Postfix) with ESMTPS id 42B425BE53 for ; Fri, 17 Apr 2026 07:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776412640; 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=QC/dDtbke/1EMHQTaSR6lx7wbLQnRWLpcqG3xicv9Ok=; b=nokRLdBzFjJ6vzLy3UIvnBaPzjOJpHDQ5d+fim1HqZMC7nGceakt8rrARmpauha095y0H7 aP86a8zxhexs+amMFlVbRlbBagMP6ihR6PTyFtxBxxxHWbzjvF0vcJBFRUHHjPlj8xXzPM RmyVf3qDi5/dzTnYgtGzMVrYEs27jFQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776412640; 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=QC/dDtbke/1EMHQTaSR6lx7wbLQnRWLpcqG3xicv9Ok=; b=TCjjRFX5DBPkc9aucC8Nr10FaMQcvAnKMutRzp837K9aH7V2xztKWfpiaaoi8SiXAlR4ou VqgzNr6oqjz5L+Bg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776412640; 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=QC/dDtbke/1EMHQTaSR6lx7wbLQnRWLpcqG3xicv9Ok=; b=nokRLdBzFjJ6vzLy3UIvnBaPzjOJpHDQ5d+fim1HqZMC7nGceakt8rrARmpauha095y0H7 aP86a8zxhexs+amMFlVbRlbBagMP6ihR6PTyFtxBxxxHWbzjvF0vcJBFRUHHjPlj8xXzPM RmyVf3qDi5/dzTnYgtGzMVrYEs27jFQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776412640; 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=QC/dDtbke/1EMHQTaSR6lx7wbLQnRWLpcqG3xicv9Ok=; b=TCjjRFX5DBPkc9aucC8Nr10FaMQcvAnKMutRzp837K9aH7V2xztKWfpiaaoi8SiXAlR4ou VqgzNr6oqjz5L+Bg== 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 29DC5593B0 for ; Fri, 17 Apr 2026 07:57:20 +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 yBPkCODn4WkYHgAAD6G6ig (envelope-from ) for ; Fri, 17 Apr 2026 07:57:20 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v6 2/4] [gdb] Add debuginfod_enabled_ask_p Date: Fri, 17 Apr 2026 09:57:17 +0200 Message-ID: <20260417075719.852558-3-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260417075719.852558-1-tdevries@suse.de> References: <20260417075719.852558-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)[99.99%]; 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)[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 0d666692ff8..56e284fbb7b 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")); @@ -285,8 +285,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. */ @@ -489,6 +499,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