From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8qbFCnug9GmM9AgAWB0awg (envelope-from ) for ; Fri, 01 May 2026 08:45:47 -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=W2462y1Z; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xV0HLnMu; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=W2462y1Z; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xV0HLnMu; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0EE7A1E0BA; Fri, 01 May 2026 08:45:47 -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_MSPIKE_H2,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 F2FCF1E067 for ; Fri, 01 May 2026 08:45:44 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id B4D3746A9CC9 for ; Fri, 1 May 2026 12:45:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4D3746A9CC9 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=W2462y1Z; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xV0HLnMu; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=W2462y1Z; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xV0HLnMu Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id C316844115C6 for ; Fri, 1 May 2026 12:45:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C316844115C6 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 C316844115C6 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777639507; cv=none; b=jg1MQiV2DfXMfOmRA6McxOb+Ji+E7LRCKkZJFHeQV0H7S9hhpMMwlVjIrRYdRrKSN0wS/hDMBpWmkUZeqyrpKiWeZBJBYOojWSQCHgSu4sH8aLcCLEH7RJxhs3lQCE9fih7pCQEvdG8kcQWuRZepvN82wmFLNwxES3iYs6knERw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777639507; c=relaxed/simple; bh=GRyFmk8rkk+bhUU5T+RWlKT09lhUeyv4Tfr/5+T276s=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=EVhmfEnL/C9JwkDBoFx2TzXjoMz0HQNGD1RV+dhgHv9TVke9i9aoRKZuhfbnhIMlCNYK4+XsVih/M6fp7/t2HSRBtoNQ0U8mopr8a/zKWQghRxPYsSmXukzMd9d1mJj2W96CmRA38/cF1kZDpEh2GZ24D/i229P2uoY9bXJSucY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C316844115C6 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 1A2FB6A8B5 for ; Fri, 1 May 2026 12:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1777639506; 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=NE7xjleaBfRDQc/hWsPCUPo/TsloAQoNiFCQ9pgWTtY=; b=W2462y1Zr74k2jtukAi1ot1EEyH1g2ODGT9d7CJJVCa8Kr1lIaszsqz2e4EOYnRBulo8KH NfBCjBk8tw04mZJjIoVGDmd/T7pJ4kN1VrXJs5K7rY01a3yYdnQvk2pSLxItXFwP/joHTo sAAsCVo2ud7IluutlbZsvgXZ5m8nNC0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1777639506; 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=NE7xjleaBfRDQc/hWsPCUPo/TsloAQoNiFCQ9pgWTtY=; b=xV0HLnMulqr4hvDj1AaQSXl2xuPIdrh4zdx1WgzaLZhUS/3vsUy20l92QzzIsdc7UvEXx3 DqW2xZnxyYhQDkDg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=W2462y1Z; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=xV0HLnMu DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1777639506; 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=NE7xjleaBfRDQc/hWsPCUPo/TsloAQoNiFCQ9pgWTtY=; b=W2462y1Zr74k2jtukAi1ot1EEyH1g2ODGT9d7CJJVCa8Kr1lIaszsqz2e4EOYnRBulo8KH NfBCjBk8tw04mZJjIoVGDmd/T7pJ4kN1VrXJs5K7rY01a3yYdnQvk2pSLxItXFwP/joHTo sAAsCVo2ud7IluutlbZsvgXZ5m8nNC0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1777639506; 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=NE7xjleaBfRDQc/hWsPCUPo/TsloAQoNiFCQ9pgWTtY=; b=xV0HLnMulqr4hvDj1AaQSXl2xuPIdrh4zdx1WgzaLZhUS/3vsUy20l92QzzIsdc7UvEXx3 DqW2xZnxyYhQDkDg== 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 06EDB593B0 for ; Fri, 1 May 2026 12:45:06 +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 QNhzAFKg9Gn5ZwAAD6G6ig (envelope-from ) for ; Fri, 01 May 2026 12:45:06 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 03/10] [gdb] Use block::containing_function_block Date: Fri, 1 May 2026 14:44:57 +0200 Message-ID: <20260501124504.2233495-4-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260501124504.2233495-1-tdevries@suse.de> References: <20260501124504.2233495-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.01 / 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)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: 1A2FB6A8B5 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 Add uses of block::containing_function_block. --- gdb/guile/scm-frame.c | 13 ++++++------- gdb/linespec.c | 15 +++++++-------- gdb/python/py-frame.c | 13 ++++++------- gdb/python/py-unwind.c | 13 +++++-------- 4 files changed, 24 insertions(+), 30 deletions(-) diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c index 722a754caab..ffcc3049074 100644 --- a/gdb/guile/scm-frame.c +++ b/gdb/guile/scm-frame.c @@ -598,7 +598,7 @@ static SCM gdbscm_frame_block (SCM self) { frame_smob *f_smob; - const struct block *block = NULL, *fn_block; + const struct block *block = nullptr; bool found = false; f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); @@ -625,12 +625,11 @@ gdbscm_frame_block (SCM self) _("")); } - for (fn_block = block; - fn_block != NULL && fn_block->function () == NULL; - fn_block = fn_block->superblock ()) - continue; - - if (block == NULL || fn_block == NULL || fn_block->function () == NULL) + const struct block *fn_block + = (block != nullptr + ? block->containing_function_block () + : nullptr); + if (fn_block == nullptr) { scm_misc_error (FUNC_NAME, _("cannot find block for frame"), scm_list_1 (self)); diff --git a/gdb/linespec.c b/gdb/linespec.c index 45e12e09272..6ed4b4553d3 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3860,17 +3860,16 @@ find_label_symbols (struct linespec_state *self, set_current_program_space (self->program_space); block = get_current_search_block (); - for (; - block && !block->function (); - block = block->superblock ()) - ; - - if (!block) + const struct block *fn_block + = (block != nullptr + ? block->containing_function_block () + : nullptr); + if (fn_block == nullptr) return {}; - fn_sym = block->function (); + fn_sym = fn_block->function (); - find_label_symbols_in_block (block, name, fn_sym, completion_mode, + find_label_symbols_in_block (fn_block, name, fn_sym, completion_mode, &result, label_funcs_ret); } else diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 1420d2ac5b9..42a281b9712 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -299,7 +299,7 @@ static PyObject * frapy_block (PyObject *self, PyObject *args) { frame_info_ptr frame; - const struct block *block = NULL, *fn_block; + const struct block *block = nullptr; try { @@ -311,12 +311,11 @@ frapy_block (PyObject *self, PyObject *args) return gdbpy_handle_gdb_exception (nullptr, except); } - for (fn_block = block; - fn_block != NULL && fn_block->function () == NULL; - fn_block = fn_block->superblock ()) - ; - - if (block == NULL || fn_block == NULL || fn_block->function () == NULL) + const struct block *fn_block + = (block != nullptr + ? block->containing_function_block () + : nullptr); + if (fn_block == nullptr) { PyErr_SetString (PyExc_RuntimeError, _("Cannot locate block for frame.")); diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index dcf86f7db3d..6dc5e11cf87 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -646,14 +646,11 @@ pending_framepy_block (PyObject *self, PyObject *args) return gdbpy_handle_gdb_exception (nullptr, except); } - for (fn_block = block; - fn_block != nullptr && fn_block->function () == nullptr; - fn_block = fn_block->superblock ()) - ; - - if (block == nullptr - || fn_block == nullptr - || fn_block->function () == nullptr) + const struct block *fn_block + = (block != nullptr + ? block->containing_function_block () + : nullptr); + if (fn_block == nullptr) { PyErr_SetString (PyExc_RuntimeError, _("Cannot locate block for frame.")); -- 2.51.0