+2020-03-17 Tom de Vries <tdevries@suse.de>
+
+ PR gdb/23710
+ * dwarf2/read.h (struct dwarf2_per_cu_data): Add unit_type and lang
+ fields.
+ * dwarf2/read.c (process_psymtab_comp_unit): Initialize unit_type and lang
+ fields.
+ (process_imported_unit_die): Skip import of c++ CUs.
+
2020-03-16 Tom Tromey <tom@tromey.com>
* p-valprint.c (pascal_object_print_value): Initialize
cutu_reader reader (this_cu, NULL, 0, false);
+ switch (reader.comp_unit_die->tag)
+ {
+ case DW_TAG_compile_unit:
+ this_cu->unit_type = DW_UT_compile;
+ break;
+ case DW_TAG_partial_unit:
+ this_cu->unit_type = DW_UT_partial;
+ break;
+ default:
+ abort ();
+ }
+
if (reader.dummy_p)
{
/* Nothing. */
reader.comp_unit_die,
pretend_language);
+ this_cu->lang = this_cu->cu->language;
+
/* Age out any secondary CUs. */
age_cached_comp_units (this_cu->dwarf2_per_objfile);
}
= dwarf2_find_containing_comp_unit (sect_off, is_dwz,
cu->per_cu->dwarf2_per_objfile);
+ /* We're importing a C++ compilation unit with tag DW_TAG_compile_unit
+ into another compilation unit, at root level. Regard this as a hint,
+ and ignore it. */
+ if (die->parent && die->parent->parent == NULL
+ && per_cu->unit_type == DW_UT_compile
+ && per_cu->lang == language_cplus)
+ return;
+
/* 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, false, cu->language);
dummy CUs (a CU header, but nothing else). */
struct dwarf2_cu *cu;
+ /* The unit type of this CU. */
+ enum dwarf_unit_type unit_type;
+
+ /* The language of this CU. */
+ enum language lang;
+
/* The corresponding dwarf2_per_objfile. */
struct dwarf2_per_objfile *dwarf2_per_objfile;