* [PATCH] Remove iterate_over_block_arg_vars_printing
@ 2026-09-15 16:56 Tom Tromey
2026-09-15 17:28 ` Simon Marchi
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2026-09-15 16:56 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Remove iterate_over_block_arg_vars_printing
2026-09-15 16:56 [PATCH] Remove iterate_over_block_arg_vars_printing Tom Tromey
@ 2026-09-15 17:28 ` Simon Marchi
0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2026-09-15 17:28 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 2026-09-15 12:56, Tom Tromey wrote:
> 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.
I guess the unneeded part is the "we need to look up the argument again
because some things gcc 1 and 2 did". Looks fine to me.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Simon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-15 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 16:56 [PATCH] Remove iterate_over_block_arg_vars_printing Tom Tromey
2026-09-15 17:28 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox