aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2025-02-07 19:14:35 -0700
committerTom Tromey <tom@tromey.com>2025-02-19 18:11:24 -0700
commitd08ab84d89035ed1ef489fc230756fa7779255a7 (patch)
tree7bd0ed2019945cf84794e83859bd8d0b5c28298e
parentc91f9c8c0a28149b8da39b4403444afa45c9ffff (diff)
downloadbinutils-d08ab84d89035ed1ef489fc230756fa7779255a7.zip
binutils-d08ab84d89035ed1ef489fc230756fa7779255a7.tar.gz
binutils-d08ab84d89035ed1ef489fc230756fa7779255a7.tar.bz2
Hoist language-finding in expand_symtabs_matching
Right now, cooked_index_functions::expand_symtabs_matching computes the language for each component of a split name, using the language of the corresponding entry. Instead, I think that we want to do all the comparisons using the final entry's language. I don't think there's a way to trigger bad behavior here right now, but with another series I'm working on, we end up with some entries whose language can't reliably be determined; and in this case using the final entry's language avoids issues. I suspect we could also dispense with the per-segment name-matcher lookup as well.
-rw-r--r--gdb/dwarf2/read.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 821f761..5ff8026 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -16130,6 +16130,7 @@ cooked_index_functions::expand_symtabs_matching
bool found = true;
const cooked_index_entry *parent = entry->get_parent ();
+ const language_defn *lang_def = language_def (entry->lang);
for (int i = name_vec.size () - 1; i > 0; --i)
{
/* If we ran out of entries, or if this segment doesn't
@@ -16141,7 +16142,6 @@ cooked_index_functions::expand_symtabs_matching
}
if (parent->lang != language_unknown)
{
- const language_defn *lang_def = language_def (parent->lang);
symbol_name_matcher_ftype *name_matcher
= lang_def->get_symbol_name_matcher
(segment_lookup_names[i-1]);
@@ -16172,7 +16172,6 @@ cooked_index_functions::expand_symtabs_matching
if (entry->lang != language_unknown)
{
- const language_defn *lang_def = language_def (entry->lang);
symbol_name_matcher_ftype *name_matcher
= lang_def->get_symbol_name_matcher
(segment_lookup_names.back ());