static int create_all_type_units (struct dwarf2_per_objfile *dwarf2_per_objfile);
-static void load_full_comp_unit (struct dwarf2_per_cu_data *,
+static void load_full_comp_unit (struct dwarf2_per_cu_data *, bool,
enum language);
static void process_full_comp_unit (struct dwarf2_per_cu_data *,
static void init_cutu_and_read_dies
(struct dwarf2_per_cu_data *this_cu, struct abbrev_table *abbrev_table,
- int use_existing_cu, int keep,
+ int use_existing_cu, int keep, bool skip_partial,
die_reader_func_ftype *die_reader_func, void *data);
static void init_cutu_and_read_dies_simple
processing PER_CU->CU. dw2_setup must have been already called. */
static void
-load_cu (struct dwarf2_per_cu_data *per_cu)
+load_cu (struct dwarf2_per_cu_data *per_cu, bool skip_partial)
{
if (per_cu->is_debug_types)
load_full_type_unit (per_cu);
else
- load_full_comp_unit (per_cu, language_minimal);
+ load_full_comp_unit (per_cu, skip_partial, language_minimal);
if (per_cu->cu == NULL)
return; /* Dummy CU. */
/* Read in the symbols for PER_CU. */
static void
-dw2_do_instantiate_symtab (struct dwarf2_per_cu_data *per_cu)
+dw2_do_instantiate_symtab (struct dwarf2_per_cu_data *per_cu, bool skip_partial)
{
struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile;
: (per_cu->v.psymtab == NULL || !per_cu->v.psymtab->readin))
{
queue_comp_unit (per_cu, language_minimal);
- load_cu (per_cu);
+ load_cu (per_cu, skip_partial);
/* If we just loaded a CU from a DWO, and we're working with an index
that may badly handle TUs, load all the TUs in that DWO as well.
table. */
static struct compunit_symtab *
-dw2_instantiate_symtab (struct dwarf2_per_cu_data *per_cu)
+dw2_instantiate_symtab (struct dwarf2_per_cu_data *per_cu, bool skip_partial)
{
struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile;
{
free_cached_comp_units freer (dwarf2_per_objfile);
scoped_restore decrementer = increment_reading_symtab ();
- dw2_do_instantiate_symtab (per_cu);
+ dw2_do_instantiate_symtab (per_cu, 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->all_comp_units.back ();
- compunit_symtab *cust = dw2_instantiate_symtab (dwarf_cu);
+ compunit_symtab *cust = dw2_instantiate_symtab (dwarf_cu, 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);
+ dw2_instantiate_symtab (per_cu, 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);
+ struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu, false);
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
func_name);
while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
- dw2_instantiate_symtab (per_cu);
+ dw2_instantiate_symtab (per_cu, false);
}
{
dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (i);
- dw2_instantiate_symtab (per_cu);
+ /* We don't want to directly expand a partial CU, because if we
+ read it with the wrong language, then assertion failures can
+ 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);
}
}
if (filename_cmp (this_fullname, fullname) == 0)
{
- dw2_instantiate_symtab (per_cu);
+ dw2_instantiate_symtab (per_cu, false);
break;
}
}
bool symtab_was_null
= (per_cu->v.quick->compunit_symtab == NULL);
- dw2_instantiate_symtab (per_cu);
+ dw2_instantiate_symtab (per_cu, false);
if (expansion_notify != NULL
&& symtab_was_null
paddress (get_objfile_arch (objfile), pc));
result
- = recursively_find_pc_sect_compunit_symtab (dw2_instantiate_symtab (data),
+ = recursively_find_pc_sect_compunit_symtab (dw2_instantiate_symtab (data,
+ 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);
+ struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu, false);
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
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);
+ dw2_instantiate_symtab (per_cu, false);
}
}
init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
struct abbrev_table *abbrev_table,
int use_existing_cu, int keep,
+ bool skip_partial,
die_reader_func_ftype *die_reader_func,
void *data)
{
init_cu_die_reader (&reader, cu, section, NULL, abbrev_table);
info_ptr = read_full_die (&reader, &comp_unit_die, info_ptr, &has_children);
+ if (skip_partial && comp_unit_die->tag == DW_TAG_partial_unit)
+ return;
+
/* If we are in a DWO stub, process it and then read in the "real" CU/TU
from the DWO file. read_cutu_die_from_dwo will allocate the abbreviation
table from the DWO file and pass the ownership over to us. It will be
free_one_cached_comp_unit (this_cu);
if (this_cu->is_debug_types)
- init_cutu_and_read_dies (this_cu, NULL, 0, 0, build_type_psymtabs_reader,
- NULL);
+ init_cutu_and_read_dies (this_cu, NULL, 0, 0, false,
+ build_type_psymtabs_reader, NULL);
else
{
process_psymtab_comp_unit_data info;
info.want_partial_unit = want_partial_unit;
info.pretend_language = pretend_language;
- init_cutu_and_read_dies (this_cu, NULL, 0, 0,
+ init_cutu_and_read_dies (this_cu, NULL, 0, 0, false,
process_psymtab_comp_unit_reader, &info);
}
}
init_cutu_and_read_dies (&tu.sig_type->per_cu, abbrev_table.get (),
- 0, 0, build_type_psymtabs_reader, NULL);
+ 0, 0, false, build_type_psymtabs_reader, NULL);
}
}
*slot = entry;
/* This does the job that build_type_psymtabs_1 would have done. */
- init_cutu_and_read_dies (&entry->per_cu, NULL, 0, 0,
+ init_cutu_and_read_dies (&entry->per_cu, NULL, 0, 0, false,
build_type_psymtabs_reader, NULL);
return 1;
static void
load_partial_comp_unit (struct dwarf2_per_cu_data *this_cu)
{
- init_cutu_and_read_dies (this_cu, NULL, 1, 1,
+ init_cutu_and_read_dies (this_cu, NULL, 1, 1, false,
load_partial_comp_unit_reader, NULL);
}
return;
}
- dw2_do_instantiate_symtab (per_cu);
+ dw2_do_instantiate_symtab (per_cu, false);
}
/* Trivial hash function for die_info: the hash value of a DIE
static void
load_full_comp_unit (struct dwarf2_per_cu_data *this_cu,
+ bool skip_partial,
enum language pretend_language)
{
gdb_assert (! this_cu->is_debug_types);
- init_cutu_and_read_dies (this_cu, NULL, 1, 1,
+ init_cutu_and_read_dies (this_cu, NULL, 1, 1, skip_partial,
load_full_comp_unit_reader, &pretend_language);
}
/* If necessary, add it to the queue and load its DIEs. */
if (maybe_queue_comp_unit (cu, per_cu, cu->language))
- load_full_comp_unit (per_cu, cu->language);
+ load_full_comp_unit (per_cu, false, cu->language);
VEC_safe_push (dwarf2_per_cu_ptr, cu->per_cu->imported_symtabs,
per_cu);
/* Note: We can't use init_cutu_and_read_dies_simple here,
we need addr_base. */
- init_cutu_and_read_dies (per_cu, NULL, 0, 0,
+ init_cutu_and_read_dies (per_cu, NULL, 0, 0, false,
dwarf2_read_addr_index_reader, &aidata);
addr_base = aidata.addr_base;
addr_size = aidata.addr_size;
/* If necessary, add it to the queue and load its DIEs. */
if (maybe_queue_comp_unit (cu, per_cu, cu->language))
- load_full_comp_unit (per_cu, cu->language);
+ load_full_comp_unit (per_cu, false, cu->language);
target_cu = per_cu->cu;
}
{
/* We're loading full DIEs during partial symbol reading. */
gdb_assert (dwarf2_per_objfile->reading_partial_symbols);
- load_full_comp_unit (cu->per_cu, language_minimal);
+ load_full_comp_unit (cu->per_cu, false, language_minimal);
}
*ref_cu = target_cu;
struct objfile *objfile = dwarf2_per_objfile->objfile;
if (per_cu->cu == NULL)
- load_cu (per_cu);
+ load_cu (per_cu, false);
cu = per_cu->cu;
if (cu == NULL)
{
struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
if (per_cu->cu == NULL)
- load_cu (per_cu);
+ load_cu (per_cu, false);
cu = per_cu->cu;
if (cu == NULL)
{
struct die_info *die;
if (per_cu->cu == NULL)
- load_cu (per_cu);
+ load_cu (per_cu, false);
cu = per_cu->cu;
if (!cu)
return NULL;
gdb_assert (per_cu->is_debug_types);
gdb_assert (per_cu->cu == NULL);
- init_cutu_and_read_dies (per_cu, NULL, 0, 1,
+ init_cutu_and_read_dies (per_cu, NULL, 0, 1, false,
read_signatured_type_reader, NULL);
sig_type->per_cu.tu_read = 1;
}