From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH v2 6/8] Have iterate_over_one_compunit_symtab search included symtabs
Date: Mon, 26 Jan 2026 14:33:08 -0700 [thread overview]
Message-ID: <20260126-dw-inline-fixup-pr-symtab-30728-2-v2-6-8ab183d1911c@tromey.com> (raw)
In-Reply-To: <20260126-dw-inline-fixup-pr-symtab-30728-2-v2-0-8ab183d1911c@tromey.com>
A latent bug in the search-via-psyms series was that it neglected to
update iterate_over_one_compunit_symtab to search included symtabs.
I think lookups that needed this search used to work by accident -- an
included CU would be expanded but not searched, but a search of all
compunits() would then find it.
This patch corrects the oversight. I'm not sure if this bug is
readily visible without the next patch.
---
gdb/symfile-debug.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index 6562dcad433..aecbd1f6deb 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -171,17 +171,12 @@ objfile::forget_cached_source_info ()
the specified compunit symtab is also searched. */
static bool
-iterate_over_one_compunit_symtab (const char *name,
+iterate_over_one_compunit_symtab (const char *base_name,
+ const char *name,
const char *real_path,
compunit_symtab *cust,
gdb::function_view<bool (symtab *)> callback)
{
- const char *base_name = lbasename (name);
-
- /* Skip included compunits. */
- if (cust->user != nullptr)
- return false;
-
for (symtab *s : cust->filetabs ())
{
if (compare_filenames_for_search (s->filename (), name))
@@ -224,6 +219,16 @@ iterate_over_one_compunit_symtab (const char *name,
}
}
+ if (cust->includes != nullptr)
+ {
+ for (compunit_symtab **iter = cust->includes;
+ *iter != nullptr;
+ ++iter)
+ if (iterate_over_one_compunit_symtab (base_name, name, real_path,
+ *iter, callback))
+ return true;
+ }
+
return false;
}
@@ -257,10 +262,14 @@ objfile::map_symtabs_matching_filename
auto listener = [&] (compunit_symtab *symtab)
{
+ /* Skip included compunits. */
+ if (symtab->user != nullptr)
+ return true;
+
/* CALLBACK returns false to keep going and true to continue, so
we have to invert the result here, for search. */
- return !iterate_over_one_compunit_symtab (name, real_path, symtab,
- callback);
+ return !iterate_over_one_compunit_symtab (name_basename, name, real_path,
+ symtab, callback);
};
for (const auto &iter : qf)
--
2.49.0
next prev parent reply other threads:[~2026-01-26 21:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 21:33 [PATCH v2 0/8] Correctly handle inline functions with dwz Tom Tromey
2026-01-26 21:33 ` [PATCH v2 1/8] Don't call add_dependence from index_imported_unit Tom Tromey
2026-01-26 21:33 ` [PATCH v2 2/8] Skip partial units in process_psymtab_comp_unit Tom Tromey
2026-01-26 21:33 ` [PATCH v2 3/8] Don't consider DW_TAG_inlined_subroutine as interesting Tom Tromey
2026-01-26 21:33 ` [PATCH v2 4/8] Combine two cases in cooked_index_functions::search Tom Tromey
2026-01-26 21:33 ` [PATCH v2 5/8] Remove C++ special case from process_imported_unit_die Tom Tromey
2026-01-26 21:33 ` Tom Tromey [this message]
2026-01-30 22:04 ` [PATCH v2 6/8] Have iterate_over_one_compunit_symtab search included symtabs Simon Marchi
2026-01-31 15:04 ` Tom Tromey
2026-01-26 21:33 ` [PATCH v2 7/8] Handle inline functions with dwz Tom Tromey
2026-02-10 3:51 ` Simon Marchi
2026-01-26 21:33 ` [PATCH v2 8/8] Update .debug_names documentation Tom Tromey
2026-02-10 4:26 ` Simon Marchi
2026-02-10 16:14 ` Tom Tromey
2026-02-10 17:03 ` Simon Marchi
2026-02-10 19:52 ` Tom Tromey
2026-02-10 20:25 ` Simon Marchi
2026-02-10 20:46 ` Tom Tromey
2026-01-26 21:42 ` [PATCH v2 0/8] Correctly handle inline functions with dwz Simon Marchi
2026-01-26 23:31 ` Tom Tromey
2026-01-26 22:05 ` Tom de Vries
2026-01-30 22:06 ` Simon Marchi
2026-03-05 18:53 ` Tom Tromey
2026-02-06 19:14 ` Tom Tromey
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=20260126-dw-inline-fixup-pr-symtab-30728-2-v2-6-8ab183d1911c@tromey.com \
--to=tom@tromey.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