/* Write the contents of the internal "cooked" index. */
static void
-write_cooked_index (dwarf2_per_objfile *per_objfile,
+write_cooked_index (cooked_index_vector *table,
const cu_index_map &cu_index_htab,
struct mapped_symtab *symtab)
{
- for (const cooked_index_entry *entry
- : per_objfile->per_bfd->cooked_index_table->all_entries ())
+ for (const cooked_index_entry *entry : table->all_entries ())
{
const auto it = cu_index_htab.find (entry->per_cu);
gdb_assert (it != cu_index_htab.cend ());
++this_counter;
}
- write_cooked_index (per_objfile, cu_index_htab, &symtab);
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
+ write_cooked_index (table, cu_index_htab, &symtab);
/* Dump the address map. */
data_buf addr_vec;
- std::vector<addrmap *> addrmaps
- = per_objfile->per_bfd->cooked_index_table->get_addrmaps ();
- for (auto map : addrmaps)
+ for (auto map : table->get_addrmaps ())
write_address_map (map, addr_vec, cu_index_htab);
/* Now that we've processed all symbols we can shrink their cu_indices
- per_objfile->per_bfd->tu_stats.nr_tus));
gdb_assert (types_counter == per_objfile->per_bfd->tu_stats.nr_tus);
- for (const cooked_index_entry *entry
- : per_objfile->per_bfd->cooked_index_table->all_entries ())
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
+ for (const cooked_index_entry *entry : table->all_entries ())
nametable.insert (entry);
nametable.build ();
{
struct objfile *objfile = per_objfile->objfile;
- if (per_objfile->per_bfd->cooked_index_table == nullptr)
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
+ if (table == nullptr)
{
- if (per_objfile->per_bfd->index_table != nullptr
- || per_objfile->per_bfd->debug_names_table != nullptr)
+ if (per_objfile->per_bfd->index_table != nullptr)
error (_("Cannot use an index to create the index"));
error (_("No debugging symbols"));
}
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)
+ domain_enum domain, offset_type namei,
+ mapped_index &index)
{
iter->per_objfile = per_objfile;
iter->block_index = block_index;
iter->vec = {};
iter->length = 0;
- mapped_index *index = per_objfile->per_bfd->index_table.get ();
-
- gdb_assert (!index->symbol_name_slot_invalid (namei));
- offset_type vec_idx = index->symbol_vec_index (namei);
+ gdb_assert (!index.symbol_name_slot_invalid (namei));
+ offset_type vec_idx = index.symbol_vec_index (namei);
- iter->vec = offset_view (index->constant_pool.slice (vec_idx));
+ iter->vec = offset_view (index.constant_pool.slice (vec_idx));
iter->length = iter->vec[0];
}
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- gdb_printf (".gdb_index: version %d\n",
- per_objfile->per_bfd->index_table->version);
+ mapped_index *index = (static_cast<mapped_index *>
+ (per_objfile->per_bfd->index_table.get ()));
+ gdb_printf (".gdb_index: version %d\n", index->version);
gdb_printf ("\n");
}
const block_enum block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
- mapped_index &index = *per_objfile->per_bfd->index_table;
+ mapped_index &index
+ = (static_cast<mapped_index &>
+ (*per_objfile->per_bfd->index_table.get ()));
const char *match_name = name.ada ().lookup_name ().c_str ();
auto matcher = [&] (const char *symname)
struct dw2_symtab_iterator iter;
struct dwarf2_per_cu_data *per_cu;
- dw2_symtab_iter_init (&iter, per_objfile, block_kind, domain, namei);
+ dw2_symtab_iter_init (&iter, per_objfile, block_kind, domain, namei,
+ index);
while ((per_cu = dw2_symtab_iter_next (&iter, index)) != NULL)
dw2_expand_symtabs_matching_one (per_cu, per_objfile, nullptr,
nullptr);
{
offset_type vec_len, vec_idx;
bool global_seen = false;
- mapped_index &index = *per_objfile->per_bfd->index_table;
+ mapped_index &index
+ = (static_cast<mapped_index &>
+ (*per_objfile->per_bfd->index_table.get ()));
offset_view vec (index.constant_pool.slice (index.symbol_vec_index (idx)));
vec_len = vec[0];
return true;
}
- mapped_index &index = *per_objfile->per_bfd->index_table;
+ mapped_index &index
+ = (static_cast<mapped_index &>
+ (*per_objfile->per_bfd->index_table.get ()));
bool result
= dw2_expand_symtabs_matching_symbol (index, *lookup_name,
create_addrmap_from_aranges (per_objfile, &per_bfd->debug_aranges);
- per_bfd->debug_names_table = std::move (map);
+ per_bfd->index_table = std::move (map);
per_bfd->quick_file_names_table =
create_quick_file_names_table (per_bfd->all_comp_units.size ());
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- mapped_debug_names &map = *per_objfile->per_bfd->debug_names_table;
+ mapped_debug_names &map
+ = (static_cast<mapped_debug_names &>
+ (*per_objfile->per_bfd->index_table.get ()));
const block_search_flags block_flags
= global ? SEARCH_GLOBAL_BLOCK : SEARCH_STATIC_BLOCK;
return true;
}
- mapped_debug_names &map = *per_objfile->per_bfd->debug_names_table;
+ mapped_debug_names &map
+ = (static_cast<mapped_debug_names &>
+ (*per_objfile->per_bfd->index_table.get ()));
bool result
= dw2_expand_symtabs_matching_symbol (map, *lookup_name,
return;
}
- /* Was a debug names index already read when we processed an objfile sharing
- PER_BFD? */
- if (per_bfd->debug_names_table != nullptr)
- {
- dwarf_read_debug_printf ("re-using shared debug names table");
- objfile->qf.push_front
- (per_bfd->debug_names_table->make_quick_functions ());
- return;
- }
-
/* Was a GDB index already read when we processed an objfile sharing
PER_BFD? */
if (per_bfd->index_table != nullptr)
{
- dwarf_read_debug_printf ("re-using shared index table");
+ dwarf_read_debug_printf ("re-using symbols");
objfile->qf.push_front (per_bfd->index_table->make_quick_functions ());
return;
}
- if (per_bfd->cooked_index_table != nullptr)
- {
- dwarf_read_debug_printf ("re-using cooked index table");
- objfile->qf.push_front
- (per_bfd->cooked_index_table->make_quick_functions ());
- return;
- }
-
if (dwarf2_read_debug_names (per_objfile))
{
dwarf_read_debug_printf ("found debug names");
objfile->qf.push_front
- (per_bfd->debug_names_table->make_quick_functions ());
+ (per_bfd->index_table->make_quick_functions ());
return;
}
if (already_attached)
{
- if (per_objfile->per_bfd->cooked_index_table != nullptr)
+ if (per_objfile->per_bfd->index_table != nullptr)
return;
}
else
}),
indexes.end ());
indexes.shrink_to_fit ();
- per_bfd->cooked_index_table.reset
- (new cooked_index_vector (std::move (indexes)));
- const cooked_index_entry *main_entry
- = per_bfd->cooked_index_table->get_main ();
+ cooked_index_vector *vec = new cooked_index_vector (std::move (indexes));
+ per_bfd->index_table.reset (vec);
+
+ const cooked_index_entry *main_entry = vec->get_main ();
if (main_entry != nullptr)
set_objfile_main_name (objfile, main_entry->name,
main_entry->per_cu->lang);
int warn_if_readin)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- if (per_objfile->per_bfd->cooked_index_table == nullptr)
+ if (per_objfile->per_bfd->index_table == nullptr)
return nullptr;
CORE_ADDR baseaddr = objfile->text_section_offset ();
- dwarf2_per_cu_data *per_cu
- = per_objfile->per_bfd->cooked_index_table->lookup (pc - baseaddr);
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
+ dwarf2_per_cu_data *per_cu = table->lookup (pc - baseaddr);
if (per_cu == nullptr)
return nullptr;
return nullptr;
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- if (per_objfile->per_bfd->cooked_index_table == nullptr)
+ if (per_objfile->per_bfd->index_table == nullptr)
return nullptr;
CORE_ADDR baseaddr = objfile->data_section_offset ();
- dwarf2_per_cu_data *per_cu
- = per_objfile->per_bfd->cooked_index_table->lookup (address - baseaddr);
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
+ dwarf2_per_cu_data *per_cu = table->lookup (address - baseaddr);
if (per_cu == nullptr)
return nullptr;
symbol_compare_ftype *ordered_compare)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- if (per_objfile->per_bfd->cooked_index_table == nullptr)
+ if (per_objfile->per_bfd->index_table == nullptr)
return;
const block_search_flags search_flags = (global
? SEARCH_GLOBAL_BLOCK
symbol_name_matcher_ftype *name_match
= lang->get_symbol_name_matcher (lookup_name);
- for (const cooked_index_entry *entry
- : per_objfile->per_bfd->cooked_index_table->all_entries ())
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
+ for (const cooked_index_entry *entry : table->all_entries ())
{
if (entry->parent_entry != nullptr)
continue;
enum search_domain kind)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- if (per_objfile->per_bfd->cooked_index_table == nullptr)
+ if (per_objfile->per_bfd->index_table == nullptr)
return true;
dw_expand_symtabs_matching_file_matcher (per_objfile, file_matcher);
language_ada
};
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
for (enum language lang : unique_styles)
{
std::vector<gdb::string_view> name_vec
= lookup_name_without_params.split_name (lang);
- for (const cooked_index_entry *entry
- : per_objfile->per_bfd->cooked_index_table->find (name_vec.back (),
- completing))
+ for (const cooked_index_entry *entry : table->find (name_vec.back (),
+ completing))
{
/* No need to consider symbols from expanded CUs. */
if (per_objfile->symtab_set_p (entry->per_cu))