[PATCH] D110363: [DWARF][NFC] add ParentIdx and SiblingIdx to DWARFDebugInfoEntry for faster navigation.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 1 11:33:49 PDT 2021


avl added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp:852
+  if (getDIEIndex(Die) == 0 && DieArray.size() > 1 &&
+      DieArray.back().getTag() == dwarf::DW_TAG_null) {
+    // For the unit die we might take last item from DieArray.
----------------
dblaikie wrote:
> avl wrote:
> > dblaikie wrote:
> > > Why is this case checked for (rather than asserted) here - but for the non-root-DIE case above, it's asserted? Is this (as the TODO suggests) an invalidity that passes for the root DIE, but is caught earlier for non-root DIEs?
> > yeas, the reason is an invalidity that passes for the root DIE, but is caught earlier for non-root DIE. The idea is that if SiblingIdx is set in DWARFUnit::extractDIEsToVector then format is good and assertion must be satisfied. But we cannot rely on SiblingIdx of the root DIE. That is why we have run-time check for the root die and assertion for others.
> Fair enough - could you expand on that in the comment a bit - explaining that there's this difference between the root node and other nodes.



```
// If SiblingIdx is set for non-root dies we could be sure that DWARF is correct 
// and "end of children marker" must be found. For root die we do not have such a 
// guarantee(parsing root die might be stopped if "end of children marker" is missing,
// SiblingIdx is always zero for root die). That is why we do not use assertion 
// for checking for "end of children marker" for root die.

```





Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110363/new/

https://reviews.llvm.org/D110363



More information about the llvm-commits mailing list