dwarf2_find_base_address (per_cu->cu->dies, per_cu->cu);
}
-/* Read in the symbols for PER_CU. */
+/* Read in the symbols for PER_CU in the context of DWARF"_PER_OBJFILE. */
static void
-dw2_do_instantiate_symtab (struct dwarf2_per_cu_data *per_cu, bool skip_partial)
+dw2_do_instantiate_symtab (dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *dwarf2_per_objfile,
+ bool skip_partial)
{
- struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile;
-
/* Skip type_unit_groups, reading the type units they contain
is handled elsewhere. */
if (per_cu->type_unit_group_p ())
age_cached_comp_units (dwarf2_per_objfile);
}
-/* Ensure that the symbols for PER_CU have been read in. OBJFILE is
- the objfile from which this CU came. Returns the resulting symbol
- table. */
+/* Ensure that the symbols for PER_CU have been read in. DWARF2_PER_OBJFILE is
+ the per-objfile for which this symtab is instantiated.
+
+ Returns the resulting symbol table. */
static struct compunit_symtab *
-dw2_instantiate_symtab (struct dwarf2_per_cu_data *per_cu, bool skip_partial)
+dw2_instantiate_symtab (dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *dwarf2_per_objfile,
+ bool skip_partial)
{
- struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile;
-
gdb_assert (dwarf2_per_objfile->per_bfd->using_index);
if (!dwarf2_per_objfile->symtab_set_p (per_cu))
{
free_cached_comp_units freer (dwarf2_per_objfile);
scoped_restore decrementer = increment_reading_symtab ();
- dw2_do_instantiate_symtab (per_cu, skip_partial);
+ dw2_do_instantiate_symtab (per_cu, dwarf2_per_objfile, skip_partial);
process_cu_includes (dwarf2_per_objfile);
}
struct dwarf2_per_objfile *dwarf2_per_objfile
= get_dwarf2_per_objfile (objfile);
dwarf2_per_cu_data *dwarf_cu = dwarf2_per_objfile->per_bfd->all_comp_units.back ();
- compunit_symtab *cust = dw2_instantiate_symtab (dwarf_cu, false);
+ compunit_symtab *cust
+ = dw2_instantiate_symtab (dwarf_cu, dwarf2_per_objfile, false);
if (cust == NULL)
return NULL;
/* This may expand more than one symtab, and we want to iterate over
all of them. */
- dw2_instantiate_symtab (per_cu, false);
+ dw2_instantiate_symtab (per_cu, per_objfile, false);
return iterate_over_some_symtabs (name, real_path, objfile->compunit_symtabs,
last_made, callback);
while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
{
struct symbol *sym, *with_opaque = NULL;
- struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu, false);
+ struct compunit_symtab *stab
+ = dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, false);
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
const struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
dw2_symtab_iter_init (&iter, dwarf2_per_objfile, {}, VAR_DOMAIN, func_name);
while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
- dw2_instantiate_symtab (per_cu, false);
+ dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, false);
}
be triggered later on. See PR symtab/23010. So, tell
dw2_instantiate_symtab to skip partial CUs -- any important
partial CU will be read via DW_TAG_imported_unit anyway. */
- dw2_instantiate_symtab (per_cu, true);
+ dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, true);
}
}
if (filename_cmp (this_fullname, fullname) == 0)
{
- dw2_instantiate_symtab (per_cu, false);
+ dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, false);
break;
}
}
static void
dw2_expand_symtabs_matching_one
- (struct dwarf2_per_cu_data *per_cu,
+ (dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile,
gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify);
dw2_symtab_iter_init (&iter, dwarf2_per_objfile, block_kind, domain,
match_name);
while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
- dw2_expand_symtabs_matching_one (per_cu, nullptr, nullptr);
+ dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile, nullptr,
+ nullptr);
return true;
});
}
static void
dw2_expand_symtabs_matching_one
- (struct dwarf2_per_cu_data *per_cu,
+ (dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile,
gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify)
{
if (file_matcher == NULL || per_cu->v.quick->mark)
{
- dwarf2_per_objfile *per_objfile = per_cu->dwarf2_per_objfile;
bool symtab_was_null = !per_objfile->symtab_set_p (per_cu);
- compunit_symtab *symtab = dw2_instantiate_symtab (per_cu, false);
+ compunit_symtab *symtab
+ = dw2_instantiate_symtab (per_cu, per_objfile, false);
gdb_assert (symtab != nullptr);
if (expansion_notify != NULL && symtab_was_null)
static void
dw2_expand_marked_cus
- (struct dwarf2_per_objfile *dwarf2_per_objfile, offset_type idx,
+ (dwarf2_per_objfile *dwarf2_per_objfile, offset_type idx,
gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
search_domain kind)
}
dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->per_bfd->get_cutu (cu_index);
- dw2_expand_symtabs_matching_one (per_cu, file_matcher,
+ dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile, file_matcher,
expansion_notify);
}
}
{
QUIT;
- dw2_expand_symtabs_matching_one (per_cu, file_matcher,
- expansion_notify);
+ dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile,
+ file_matcher, expansion_notify);
}
return;
}
warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"),
paddress (objfile->arch (), pc));
- result
- = recursively_find_pc_sect_compunit_symtab (dw2_instantiate_symtab (data,
- false),
- pc);
+ result = recursively_find_pc_sect_compunit_symtab
+ (dw2_instantiate_symtab (data, per_objfile, false), pc);
+
gdb_assert (result != NULL);
return result;
}
while ((per_cu = iter.next ()) != NULL)
{
struct symbol *sym, *with_opaque = NULL;
- struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu, false);
+ compunit_symtab *stab
+ = dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, false);
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
const struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
struct dwarf2_per_cu_data *per_cu;
while ((per_cu = iter.next ()) != NULL)
- dw2_instantiate_symtab (per_cu, false);
+ dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, false);
}
}
struct dwarf2_per_cu_data *per_cu;
while ((per_cu = iter.next ()) != NULL)
- dw2_expand_symtabs_matching_one (per_cu, nullptr, nullptr);
+ dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile, nullptr,
+ nullptr);
return true;
});
{
QUIT;
- dw2_expand_symtabs_matching_one (per_cu, file_matcher,
- expansion_notify);
+ dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile,
+ file_matcher, expansion_notify);
}
return;
}
struct dwarf2_per_cu_data *per_cu;
while ((per_cu = iter.next ()) != NULL)
- dw2_expand_symtabs_matching_one (per_cu, file_matcher,
- expansion_notify);
+ dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile,
+ file_matcher, expansion_notify);
return true;
});
}
expand_dependencies (objfile);
- dw2_do_instantiate_symtab (per_cu_data, false);
+ dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
+ dw2_do_instantiate_symtab (per_cu_data, per_objfile, false);
gdb_assert (get_compunit_symtab (objfile) != nullptr);
}