aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarf2/read.c')
-rw-r--r--gdb/dwarf2/read.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index acbc5fa..2bfb13d 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7737,7 +7737,10 @@ process_psymtab_comp_unit (dwarf2_per_cu_data *this_cu,
this_cu->unit_type = DW_UT_type;
break;
default:
- abort ();
+ error (_("Dwarf Error: unexpected tag '%s' at offset %s [in module %s]"),
+ dwarf_tag_name (reader.comp_unit_die->tag),
+ sect_offset_str (reader.cu->per_cu->sect_off),
+ objfile_name (per_objfile->objfile));
}
if (reader.dummy_p)
@@ -9994,6 +9997,21 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
dwarf2_find_base_address (cu->dies, cu);
+ /* Before we start reading the top-level DIE, ensure it has a valid tag
+ type. */
+ switch (cu->dies->tag)
+ {
+ case DW_TAG_compile_unit:
+ case DW_TAG_partial_unit:
+ case DW_TAG_type_unit:
+ break;
+ default:
+ error (_("Dwarf Error: unexpected tag '%s' at offset %s [in module %s]"),
+ dwarf_tag_name (cu->dies->tag),
+ sect_offset_str (cu->per_cu->sect_off),
+ objfile_name (per_objfile->objfile));
+ }
+
/* Do line number decoding in read_file_scope () */
process_die (cu->dies, cu);
@@ -13628,6 +13646,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
}
}
+ gdb_assert (cu->get_builder () != nullptr);
newobj = cu->get_builder ()->push_context (0, lowpc);
newobj->name = new_symbol (die, read_type_die (die, cu), cu,
(struct symbol *) templ_func);