[Lldb-commits] [PATCH] D53321: Code cleanup: Remove DWARFDebugInfoEntry::m_empty_children

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 16 07:33:14 PDT 2018

clayborg added a comment.

m_has_children was used to represent what was in the DWARF in the byte that follows the DW_TAG. m_empty_children was used for DIEs that said they had children but actually only contain a single NULL tag. It is fine to not differentiate between the two.

Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h:282
                          // If zero this die has no parent
-  uint32_t m_sibling_idx : 31, // How many to add to "this" to get the sibling.
-      m_empty_children : 1;    // If a DIE says it had children, yet it just
-                               // contained a NULL tag, this will be set.
+  uint32_t m_sibling_idx; // How many to add to "this" to get the sibling.
   uint32_t m_abbr_idx : DIE_ABBR_IDX_BITSIZE,
We might want to move m_has_children where m_empty_children used to be and give a bit back to m_abbr_idx by increasing DIE_ABBR_IDX_BITSIZE by 1. We have a few bits to spare in m_sibling_idx since it is the number of dies to advance by to get to the sibling. Since DIEs at the very least are a few bytes, having a 2GB advance instead of 4GB is plenty.

Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h:285-287
+                                            // It is zero if a DIE says it had
+                                            // children, yet it just contained
+                                            // a NULL tag.
This comment is wrong. The DWARF encodes if a DIE has children in the .debug_info, but we may override this value if the DIE only contains an NULL terminating DIE.

It should read something like:
// If it is zero, then the DIE doesn't have children, or the 
// DWARF claimed it had children but the DIE only contained 
// a single NULL terminating child.



More information about the lldb-commits mailing list