From faec6dd9a2987d4322ebd7ce235b8544ea2e2bcf Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 16 Oct 2018 11:38:22 +0000 Subject: [PATCH] Fix: Assertion failed: (!m_first_die || m_first_die == m_die_array.front()), function ExtractDIEsRWLocked xbolva00 bugreported $subj in: https://reviews.llvm.org/D46810#1247410 It can happen only from the line: m_die_array.back().SetEmptyChildren(true); In the case DW_TAG_compile_unit has DW_CHILDREN_yes but there is only 0 (end of list, no children present). Therefore the assertion can fortunately happen only with a hand-crafted DWARF or with DWARF from some suboptimal compilers. Differential Revision: https://reviews.llvm.org/D53255 llvm-svn: 344605 --- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index f44b2bb97b2b0..d26556d73e28d 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -261,7 +261,11 @@ void DWARFUnit::ExtractDIEsRWLocked() { } if (!m_die_array.empty()) { - lldbassert(!m_first_die || m_first_die == m_die_array.front()); + if (m_first_die) { + // Only needed for the assertion. + m_first_die.SetEmptyChildren(m_die_array.front().GetEmptyChildren()); + lldbassert(m_first_die == m_die_array.front()); + } m_first_die = m_die_array.front(); }