[Lldb-commits] [PATCH] D53255: Fix: Assertion failed: (!m_first_die || m_first_die == m_die_array.front()), function ExtractDIEsRWLocked

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Oct 14 06:50:46 PDT 2018

jankratochvil created this revision.
jankratochvil added reviewers: clayborg, labath.
jankratochvil added a project: LLDB.
Herald added subscribers: JDevlieghere, aprantl.

xbolva00 bugreported $subj <https://reviews.llvm.org/D46810#1247410>
It can happen only from the line:


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.
I could not find a reproducer with unpatched LLDB code, could you provide what LLDB commands could reproduce that? A debuggee binary which can reproduce it is: lldb-repro.tar.xz </home/jkratoch/t/lldb-repro.tar.xz>




Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -261,7 +261,11 @@
   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();

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53255.169598.patch
Type: text/x-patch
Size: 600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181014/c0959b8c/attachment.bin>

More information about the lldb-commits mailing list