================ @@ -339,6 +348,39 @@ void DWARFDebugInfoEntry::GetAttributes(DWARFUnit *cu, DWARFFormValue::SkipValue(form, data, &offset, cu); } } + + return true; +} + +DWARFAttributes DWARFDebugInfoEntry::GetAttributes(const DWARFUnit *cu, + Recurse recurse) const { + // FIXME: use ElaboratingDIEIterator to follow specifications/abstract origins + // instead of maintaining our own worklist/seen list. + + DWARFAttributes attributes; + + llvm::SmallVector<DWARFDIE, 3> worklist; + worklist.emplace_back(cu, this); + + // Keep track if DIEs already seen to prevent infinite recursion. + // Value of '3' was picked for the same reason that + // DWARFDie::findRecursively does. + llvm::SmallSet<DWARFDebugInfoEntry const *, 3> seen; + seen.insert(this); + + while (!worklist.empty()) { + if (!::GetAttributes(cu, worklist, seen, attributes)) { + attributes.Clear(); + break; + } + + // We visited the current DIE already and were asked not to check the + // rest of the worklist. So bail out. + if (recurse == Recurse::no) + break; + } ---------------- Michael137 wrote:
Looks good :D https://github.com/llvm/llvm-project/pull/123261 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits