From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 10/11] gdb: make symbol_found_callback_ftype a function_view
Date: Thu, 16 Apr 2026 16:16:20 -0400 [thread overview]
Message-ID: <20260416202408.422441-11-simon.marchi@efficios.com> (raw)
In-Reply-To: <20260416202408.422441-1-simon.marchi@efficios.com>
From: Simon Marchi <simon.marchi@polymtl.ca>
All uses of symbol_found_callback_ftype use it within a function_view,
so factor out the function_view into the type alias.
Change-Id: I24a1d2fc233aa5d593c9c68581a9912bfee3a348
---
gdb/ada-lang.c | 2 +-
gdb/language.h | 2 +-
gdb/linespec.c | 6 +++---
gdb/symtab.c | 2 +-
gdb/symtab.h | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index f8ed4cc5e102..d388a301fa1a 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13705,7 +13705,7 @@ class ada_language : public language_defn
bool iterate_over_symbols
(const struct block *block, const lookup_name_info &name,
domain_search_flags domain,
- gdb::function_view<symbol_found_callback_ftype> callback) const override
+ symbol_found_callback_ftype callback) const override
{
std::vector<struct block_symbol> results
= ada_lookup_symbol_list_worker (name, block, domain, 0);
diff --git a/gdb/language.h b/gdb/language.h
index da903eb702d2..0cc075f8a295 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -362,7 +362,7 @@ struct language_defn
virtual bool iterate_over_symbols
(const struct block *block, const lookup_name_info &name,
domain_search_flags domain,
- gdb::function_view<symbol_found_callback_ftype> callback) const
+ symbol_found_callback_ftype callback) const
{
return ::iterate_over_symbols (block, name, domain, callback);
}
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 0afe0c619a13..bfdd075ac825 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -363,7 +363,7 @@ struct linespec_parser
static void iterate_over_file_blocks
(struct symtab *symtab, const lookup_name_info &name,
domain_search_flags domain,
- gdb::function_view<symbol_found_callback_ftype> callback);
+ symbol_found_callback_ftype callback);
static void initialize_defaults (struct symtab **default_symtab,
int *default_line);
@@ -1128,7 +1128,7 @@ iterate_over_all_matching_symtabs
const lookup_name_info &lookup_name,
const domain_search_flags domain,
struct program_space *search_pspace, bool include_inline,
- gdb::function_view<symbol_found_callback_ftype> callback)
+ symbol_found_callback_ftype callback)
{
for (struct program_space *pspace : program_spaces)
{
@@ -1196,7 +1196,7 @@ static void
iterate_over_file_blocks
(struct symtab *symtab, const lookup_name_info &name,
domain_search_flags domain,
- gdb::function_view<symbol_found_callback_ftype> callback)
+ symbol_found_callback_ftype callback)
{
const struct block *block;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index fd841318387e..62d9ecf0ee0a 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2700,7 +2700,7 @@ bool
iterate_over_symbols (const struct block *block,
const lookup_name_info &name,
const domain_search_flags domain,
- gdb::function_view<symbol_found_callback_ftype> callback)
+ symbol_found_callback_ftype callback)
{
for (struct symbol *sym : block_iterator_range (block, &name))
{
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 3936052706f1..3217d00914ce 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2811,7 +2811,7 @@ std::vector<const linetable_entry *> find_linetable_entries_for_symtab_line
true to indicate that LA_ITERATE_OVER_SYMBOLS should continue
iterating, or false to indicate that the iteration should end. */
-typedef bool (symbol_found_callback_ftype) (struct block_symbol *bsym);
+using symbol_found_callback_ftype = gdb::function_view<bool (block_symbol *)>;
/* Iterate over the symbols named NAME, matching DOMAIN, in BLOCK.
@@ -2825,7 +2825,7 @@ typedef bool (symbol_found_callback_ftype) (struct block_symbol *bsym);
bool iterate_over_symbols (const struct block *block,
const lookup_name_info &name,
const domain_search_flags domain,
- gdb::function_view<symbol_found_callback_ftype> callback);
+ symbol_found_callback_ftype callback);
/* Storage type used by demangle_for_lookup. demangle_for_lookup
either returns a const char * pointer that points to either of the
--
2.53.0
next prev parent reply other threads:[~2026-04-16 20:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 20:16 [PATCH 00/11] Readability improvements of some iteration functions Simon Marchi
2026-04-16 20:16 ` [PATCH 01/11] gdb/dwarf: remove unused file_match parameter from dwarf2_base_index_functions::search_one Simon Marchi
2026-04-16 20:16 ` [PATCH 02/11] gdb: rename search_symtabs_expansion_listener -> compunit_symtab_iteration_callback Simon Marchi
2026-04-16 20:16 ` [PATCH 03/11] gdb: introduce iteration_status enum, use it for search callbacks Simon Marchi
2026-04-16 20:16 ` [PATCH 04/11] gdb, gdbserver: make iterate_over_lwps_ftype a function_view Simon Marchi
2026-04-16 20:16 ` [PATCH 05/11] gdb, gdbserver: split iterate_over_lwps in for_each_lwp and find_lwp Simon Marchi
2026-04-16 20:16 ` [PATCH 06/11] gdb: split iterate_over_threads in for_each_thread and find_thread Simon Marchi
2026-04-16 20:16 ` [PATCH 07/11] gdb: split iterate_over_minimal_symbols in for_each_minimal_symbol and find_minimal_symbol Simon Marchi
2026-04-16 20:16 ` [PATCH 08/11] gdb: split iterate_over_symtabs in for_each_symtab and find_symtab Simon Marchi
2026-04-16 20:16 ` [PATCH 09/11] gdb: change objfile::map_symtabs_matching_filename to find_symtab_matching_filename Simon Marchi
2026-04-16 20:16 ` Simon Marchi [this message]
2026-04-16 20:16 ` [PATCH 11/11] gdb: make iterate_over_symbols return void, rename to for_each_symbol 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=20260416202408.422441-11-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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