From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Remove iterate_over_block_arg_vars_printing
Date: Tue, 15 Sep 2026 10:56:34 -0600 [thread overview]
Message-ID: <20260915165634.3008224-1-tromey@adacore.com> (raw)
Back in commit c76bd1b0 ("Remove symbol lookup of arguments"), I
removed some old stabs code that performed a double lookup of argument
symbols.
I was surprised today to find that this double-lookup re-entered the
tree in commit 2465b9e4 ("gdb: add annotation in 'info locals' command
for variables shadowing case").
That patch added copies of a couple of block iteration functions. The
function in question, iterate_over_block_arg_vars_printing, is not
really needed. This patch removes it, removing the old stabs code as
a consequence.
Regression tested on x86-64 Fedora 43.
---
gdb/stack.c | 37 +++++--------------------------------
gdb/stack.h | 7 -------
2 files changed, 5 insertions(+), 39 deletions(-)
diff --git a/gdb/stack.c b/gdb/stack.c
index 003811e9c08..c380cf4f7d0 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2453,37 +2453,6 @@ iterate_over_block_arg_vars (const struct block *b,
}
}
-/* See stack.h. */
-
-void
-iterate_over_block_arg_vars_printing
- (const struct block *b,
- iterate_over_block_arg_local_vars_cb_printing cb)
-{
- for (struct symbol *sym : block_iterator_range (b))
- {
- /* Don't worry about things which aren't arguments. */
- if (sym->is_argument ())
- {
- /* We have to look up the symbol because arguments can have
- two entries (one a parameter, one a local) and the one we
- want is the local, which lookup_symbol will find for us.
- This includes gcc1 (not gcc2) on the sparc when passing a
- small structure and gcc2 when the argument type is float
- and it is passed as a double and converted to float by
- the prologue (in the latter case the type of the LOC_ARG
- symbol is double and the type of the LOC_LOCAL symbol is
- float). There are also LOC_ARG/LOC_REGISTER pairs which
- are not combined in symbol-reading. */
-
- struct symbol *sym2
- = lookup_symbol_search_name (sym->search_name (),
- b, SEARCH_VAR_DOMAIN).symbol;
- cb (sym->print_name (), sym2, var_shadowing::NONE);
- }
- }
-}
-
/* Print all argument variables of the function of FRAME.
Print them with values to STREAM.
If REGEXP is not NULL, only print argument variables whose name
@@ -2526,7 +2495,11 @@ print_frame_arg_vars (const frame_info_ptr &frame,
cb_data.stream = stream;
cb_data.values_printed = 0;
- iterate_over_block_arg_vars_printing (func->value_block (), cb_data);
+ iterate_over_block_arg_vars (func->value_block (),
+ [&] (const char *print_name, symbol *sym)
+ {
+ cb_data (print_name, sym, var_shadowing::NONE);
+ });
if (!cb_data.values_printed && !quiet)
{
diff --git a/gdb/stack.h b/gdb/stack.h
index 4f7c223f47f..819f5993004 100644
--- a/gdb/stack.h
+++ b/gdb/stack.h
@@ -39,13 +39,6 @@ void iterate_over_block_arg_vars (const struct block *block,
void iterate_over_block_local_vars (const struct block *block,
iterate_over_block_arg_local_vars_cb cb);
-/* Iterate over all the argument variables in block B, call CB for
- each variable with its print name, symbol, and shadowing status. */
-
-void iterate_over_block_arg_vars_printing
- (const struct block *block,
- iterate_over_block_arg_local_vars_cb_printing cb);
-
/* Iterate over all the local variables in block B, including all its
superblocks, stopping when the top-level block is reached. Call CB
for each variable with its print name, symbol, and shadowing status
base-commit: 71400155a3c026269f2602fa168a15b739ae8e39
--
2.55.0
next reply other threads:[~2026-09-15 16:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 16:56 Tom Tromey [this message]
2026-09-15 17:28 ` Simon Marchi
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=20260915165634.3008224-1-tromey@adacore.com \
--to=tromey@adacore.com \
--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