Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <20260501124504.2233495-1-tdevries@suse.de> (raw)

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
-- 
2.51.0


             reply	other threads:[~2026-05-01 12:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01 12:44 Tom de Vries [this message]
2026-05-01 12:44 ` [PATCH 01/10] [gdb] Use block::containing_function Tom de Vries
2026-05-01 12:44 ` [PATCH 02/10] [gdb] Factor out block::containing_function_block Tom de Vries
2026-05-01 12:44 ` [PATCH 03/10] [gdb] Use block::containing_function_block Tom de Vries
2026-05-01 12:44 ` [PATCH 04/10] [gdb] Add unit test for next_iterator Tom de Vries
2026-05-01 12:44 ` [PATCH 05/10] [gdbsupport] Use using instead of typedef in next_iterator Tom de Vries
2026-05-01 12:45 ` [PATCH 06/10] [gdbsupport] Factor out base_next_iterator Tom de Vries
2026-05-08 19:17   ` Tom Tromey
2026-05-01 12:45 ` [PATCH 07/10] [gdb] Add block::block_and_superblocks Tom de Vries
2026-05-01 12:45 ` [PATCH 08/10] [gdb] Use block::block_and_superblocks Tom de Vries
2026-05-08 19:41   ` Tom Tromey
2026-05-01 12:45 ` [PATCH 09/10] [gdb] Add block::block_and_superblocks_in_fn Tom de Vries
2026-05-01 12:45 ` [PATCH 10/10] [gdb] Use block::block_and_superblocks_in_fn Tom de Vries
2026-06-09 12:40 ` [PATCH 00/10] [gdb] Add superblocks range loops Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260501124504.2233495-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox