aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r--gdb/dwarf2/read.c7
-rw-r--r--gdb/dwarf2/read.h10
2 files changed, 10 insertions, 7 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 9f92b42..55e61b88 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -8538,10 +8538,11 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
/* 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. */
+ and ignore it. This is a best effort, it only works if unit_type and
+ lang are already set. */
if (die->parent && die->parent->parent == NULL
- && per_cu->unit_type () == DW_UT_compile
- && per_cu->lang () == language_cplus)
+ && per_cu->unit_type (false) == DW_UT_compile
+ && per_cu->lang (false) == language_cplus)
return;
/* If necessary, add it to the queue and load its DIEs. */
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 1d9c66a..c9afa07 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -306,9 +306,10 @@ public:
gdb_assert (m_dwarf_version == version);
}
- dwarf_unit_type unit_type () const
+ dwarf_unit_type unit_type (bool strict_p = true) const
{
- gdb_assert (m_unit_type != 0);
+ if (strict_p)
+ gdb_assert (m_unit_type != 0);
return m_unit_type;
}
@@ -322,9 +323,10 @@ public:
gdb_assert (m_unit_type == unit_type);
}
- enum language lang () const
+ enum language lang (bool strict_p = true) const
{
- gdb_assert (m_lang != language_unknown);
+ if (strict_p)
+ gdb_assert (m_lang != language_unknown);
return m_lang;
}