| Message ID | 20260501124504.2233495-1-tdevries@suse.de |
|---|---|
| Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id BDB9C46A9CEE for <patchwork@sourceware.org>; Fri, 1 May 2026 12:45:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BDB9C46A9CEE 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=ardM65b6; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pbABq5v+; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=ardM65b6; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pbABq5v+ X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id C165C44115C4 for <gdb-patches@sourceware.org>; Fri, 1 May 2026 12:45:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C165C44115C4 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 C165C44115C4 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=1777639506; cv=none; b=KZnQ6QrhU7EOoUVZBV25W/eJcnWL/kaVvIWAMGWl8YBzHy+zpEHX1EWyrTQ6GGFo5w7IfCobu0IURdcR7Y9mCStuGXQn2sqS8iNfEPqJZCeJTVRgrjiA9huWqiFsjHgfbQXibCqqT4oJbt0EkJjJHa2bYGRKUBPZSC0qAEQS1mE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777639506; c=relaxed/simple; bh=o6dBQiyxIV7OebGqfRPVGvvqOdqR59vC5J+ItGCVOvI=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=INggkIfIw0lppboJAIcMbB0JlkKZbg/mUHjRsRb83WHAHwxi/C6aiyMQWPV/hcaONa5qlsR5l8cslQGRUvyJPvdbT3Qod7gADEebZkF541yNtGx+1PU6vh/BSLqy4ZLBrJfGG61eY8FFkj5BAbSnaPIavfdAlfjzBL1fwzZ54xo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C165C44115C4 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 BB9FD5BD17 for <gdb-patches@sourceware.org>; Fri, 1 May 2026 12:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1777639505; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nLYR18gHBVGPIhcnJGu6hJ2LX2G0b3eEo8wTYVXT6Sc=; b=ardM65b6auUR6QuFNxCBA/g7M3tqyT7+4+6imI3QTyRcib7MMfW9AwgmdvGMysglPfkwVC Rvt4Ed+OlMu4/ZOARo3vTHgrOeMtjCY+GrhvCuYFGLZNDegGYYHP2Z+bwg5BgGMr4A2s0D R++fKswLUwb9+Sk7anYLeuxu1Ukx6uU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1777639505; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nLYR18gHBVGPIhcnJGu6hJ2LX2G0b3eEo8wTYVXT6Sc=; b=pbABq5v+jVE7o6pAZQ0AyAjOziGBWI10aORClg0B2DAW60ZnI5Khp4LjvFsoCKTWzwUGkw YwRC0SUNlerbMQBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1777639505; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nLYR18gHBVGPIhcnJGu6hJ2LX2G0b3eEo8wTYVXT6Sc=; b=ardM65b6auUR6QuFNxCBA/g7M3tqyT7+4+6imI3QTyRcib7MMfW9AwgmdvGMysglPfkwVC Rvt4Ed+OlMu4/ZOARo3vTHgrOeMtjCY+GrhvCuYFGLZNDegGYYHP2Z+bwg5BgGMr4A2s0D R++fKswLUwb9+Sk7anYLeuxu1Ukx6uU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1777639505; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nLYR18gHBVGPIhcnJGu6hJ2LX2G0b3eEo8wTYVXT6Sc=; b=pbABq5v+jVE7o6pAZQ0AyAjOziGBWI10aORClg0B2DAW60ZnI5Khp4LjvFsoCKTWzwUGkw YwRC0SUNlerbMQBw== 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 A7A98593B0 for <gdb-patches@sourceware.org>; Fri, 1 May 2026 12:45:05 +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 aMWYJ1Gg9Gn5ZwAAD6G6ig (envelope-from <tdevries@suse.de>) for <gdb-patches@sourceware.org>; Fri, 01 May 2026 12:45:05 +0000 From: Tom de Vries <tdevries@suse.de> To: gdb-patches@sourceware.org Subject: [PATCH 00/10] [gdb] Add superblocks range loops Date: Fri, 1 May 2026 14:44:54 +0200 Message-ID: <20260501124504.2233495-1-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.80 X-Spam-Level: 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,imap1.dmz-prg2.suse.org:helo,sourceware.org:url]; 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-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
Add superblocks range loops
|
|
Message
Tom de Vries
May 1, 2026, 12:44 p.m. UTC
This series attempts to rewrite code like this:
...
while (block != NULL)
{
...
block = block->superblock ();
}
...
using range loops.
I haven't rewritten loops in block.c itself.
An RFC was submitted here [1].
Changes in v1:
- commit first two patches of RFC
- add a patch adding uses of block::containing_function
- add patches adding and using block::containing_function_block
- add next_iterator unit test, also excercising incomplete type case
- modernize next_iterator by replacing typedef with using
- rewrite base_next_iterator to use Curiously Recurring Template Pattern
- use using to import constructors in next_iterator
- move comment part showing "using a pointer-to-member template argument
T::next" to commit message
- change names to block_and_superblocks block_and_superblocks_in_fn
- add some missing comments
- complete the refactoring using the range loops
- clarify behaviour of block_and_superblocks_in_fn in relation to static and
global blocks in commit message
- also avoid static and global blocks in function_block_iterator::next
[1] https://sourceware.org/pipermail/gdb-patches/2026-April/226720.html
Tom de Vries (10):
[gdb] Use block::containing_function
[gdb] Factor out block::containing_function_block
[gdb] Use block::containing_function_block
[gdb] Add unit test for next_iterator
[gdbsupport] Use using instead of typedef in next_iterator
[gdbsupport] Factor out base_next_iterator
[gdb] Add block::block_and_superblocks
[gdb] Use block::block_and_superblocks
[gdb] Add block::block_and_superblocks_in_fn
[gdb] Use block::block_and_superblocks_in_fn
gdb/Makefile.in | 1 +
gdb/ada-lang.c | 61 ++++------
gdb/block.c | 18 ++-
gdb/block.h | 102 ++++++++++++++++
gdb/blockframe.c | 11 +-
gdb/compile/compile-c-symbols.c | 10 +-
gdb/compile/compile-object-load.c | 8 +-
gdb/cp-namespace.c | 6 +-
gdb/cp-support.c | 8 +-
gdb/d-namespace.c | 6 +-
gdb/dwarf2/line-program.c | 24 ++--
gdb/f-valprint.c | 19 ++-
gdb/go-lang.c | 31 ++---
gdb/guile/scm-frame.c | 13 +-
gdb/infrun.c | 10 +-
gdb/inline-frame.c | 45 ++++---
gdb/linespec.c | 22 ++--
gdb/mi/mi-cmd-stack.c | 155 +++++++++++-------------
gdb/python/py-frame.c | 13 +-
gdb/python/py-unwind.c | 15 +--
gdb/stack.c | 15 +--
gdb/symmisc.c | 9 +-
gdb/symtab.c | 69 ++++++-----
gdb/tracepoint.c | 9 +-
gdb/unittests/next-iterator-selftests.c | 105 ++++++++++++++++
gdbsupport/next-iterator.h | 48 +++++---
gdbsupport/safe-iterator.h | 12 +-
27 files changed, 511 insertions(+), 334 deletions(-)
create mode 100644 gdb/unittests/next-iterator-selftests.c
base-commit: 27d21139e356aca4b77d32e81105c465f1e6650c
Comments
On 5/1/26 2:44 PM, Tom de Vries wrote: > [gdb] Add unit test for next_iterator > [gdbsupport] Use using instead of typedef in next_iterator I've committed these two patches. I had Claude Code review these, and it complained about a magic constant in the unit test, so I eliminated this. The change is so trivial that it doesn't look worth the trouble of re-posting the patch. Thanks, - Tom