int global_seen;
};
-/* Initialize the index symtab iterator ITER. */
+/* Initialize the index symtab iterator ITER, common part. */
static void
-dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
- dwarf2_per_objfile *per_objfile,
- gdb::optional<block_enum> block_index,
- domain_enum domain,
- const char *name)
+dw2_symtab_iter_init_common (struct dw2_symtab_iterator *iter,
+ dwarf2_per_objfile *per_objfile,
+ gdb::optional<block_enum> block_index,
+ domain_enum domain)
{
iter->per_objfile = per_objfile;
iter->block_index = block_index;
iter->domain = domain;
iter->next = 0;
iter->global_seen = 0;
+ iter->vec = NULL;
+ iter->length = 0;
+}
- mapped_index *index = per_objfile->per_bfd->index_table.get ();
+/* Initialize the index symtab iterator ITER, const char *NAME variant. */
+
+static void
+dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
+ dwarf2_per_objfile *per_objfile,
+ gdb::optional<block_enum> block_index,
+ domain_enum domain,
+ const char *name)
+{
+ dw2_symtab_iter_init_common (iter, per_objfile, block_index, domain);
+ mapped_index *index = per_objfile->per_bfd->index_table.get ();
/* index is NULL if OBJF_READNOW. */
- if (index != NULL && find_slot_in_mapped_hash (index, name, &iter->vec))
+ if (index == NULL)
+ return;
+
+ if (find_slot_in_mapped_hash (index, name, &iter->vec))
iter->length = MAYBE_SWAP (*iter->vec);
- else
- {
- iter->vec = NULL;
- iter->length = 0;
- }
+}
+
+/* Initialize the index symtab iterator ITER, offset_type NAMEI variant. */
+
+static void
+dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
+ dwarf2_per_objfile *per_objfile,
+ gdb::optional<block_enum> block_index,
+ domain_enum domain, offset_type namei)
+{
+ dw2_symtab_iter_init_common (iter, per_objfile, block_index, domain);
+
+ mapped_index *index = per_objfile->per_bfd->index_table.get ();
+ /* index is NULL if OBJF_READNOW. */
+ if (index == NULL)
+ return;
+
+ gdb_assert (!index->symbol_name_slot_invalid (namei));
+ const auto &bucket = index->symbol_table[namei];
+
+ iter->vec = (offset_type *) (index->constant_pool
+ + MAYBE_SWAP (bucket.vec));
+ iter->length = MAYBE_SWAP (*iter->vec);
}
/* Return the next matching CU or NULL if there are no more. */
struct dwarf2_per_cu_data *per_cu;
dw2_symtab_iter_init (&iter, per_objfile, block_kind, domain,
- match_name);
+ namei);
while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
dw2_expand_symtabs_matching_one (per_cu, per_objfile, nullptr,
nullptr);