aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-11-22 16:50:46 -0700
committerTom Tromey <tom@tromey.com>2022-04-20 09:10:03 -0600
commitc1a56932c4b61f1fe81ce847cb40770203ffd16f (patch)
treee642346ad78e183386eedd514838a0229ac4de93
parent6606799fc4aaf812d0986166f57c9849b5d562ed (diff)
downloadgdb-c1a56932c4b61f1fe81ce847cb40770203ffd16f.zip
gdb-c1a56932c4b61f1fe81ce847cb40770203ffd16f.tar.gz
gdb-c1a56932c4b61f1fe81ce847cb40770203ffd16f.tar.bz2
Simplify version check in dw2_symtab_iter_next
This simplifies the index versio check in dw2_symtab_iter_next, by passing a reference to the index object to this function. This avoids an indirection via the per_bfd object.
-rw-r--r--gdb/dwarf2/read.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 3053ec9..f340cd6 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2949,7 +2949,8 @@ dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
/* Return the next matching CU or NULL if there are no more. */
static struct dwarf2_per_cu_data *
-dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
+dw2_symtab_iter_next (struct dw2_symtab_iterator *iter,
+ mapped_index &index)
{
dwarf2_per_objfile *per_objfile = iter->per_objfile;
@@ -2963,9 +2964,8 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
Indices prior to version 7 don't record them,
and indices >= 7 may elide them for certain symbols
(gold does this). */
- int attrs_valid =
- (per_objfile->per_bfd->index_table->version >= 7
- && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
+ int attrs_valid = (index.version >= 7
+ && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
/* Don't crash on bad data. */
if (cu_index >= per_objfile->per_bfd->all_comp_units.size ())
@@ -3141,7 +3141,7 @@ dwarf2_gdb_index::expand_matching_symbols
struct dwarf2_per_cu_data *per_cu;
dw2_symtab_iter_init (&iter, per_objfile, block_kind, domain, namei);
- while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
+ while ((per_cu = dw2_symtab_iter_next (&iter, index)) != NULL)
dw2_expand_symtabs_matching_one (per_cu, per_objfile, nullptr,
nullptr);
return true;