[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)

Zequan Wu via lldb-commits lldb-commits at lists.llvm.org
Tue May 21 11:10:10 PDT 2024


================
@@ -2306,6 +2345,11 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die,
 
   if (!die)
     return false;
+  ParsedDWARFTypeAttributes attrs(die);
----------------
ZequanWu wrote:

> The reason why this crash does not happen when attempting to complete a type with no definition is because this function is the actual implementation of "completing a type from a defintion". I.e., it expects to be called with a definition DIE, and will never be called if there is no definition (we will bail out, and possibly "forcefully" complete the type somewhere higher up the stack).

Yes, it should only be called with definition DIE. This extra check just a double-check for it with a bit performance cost. If there's no definition DIE, `SymbolFileDWARF::CompleteType` does an early return. This behaviour is unchanged. Forceful completion behaviour is also remained unchanged, happens when failed to find definition DIE of a containing record type.

> If that is true, then I think Greg's patch is a better fix for this problem, and it also sidesteps all of the performance/memory tradeoff discussions.

I agree. If we can ensure the DIE is always a definition DIE for both manual index and debug_names index at a earlier time, there's no need for this check. I'll remove this check when Greg's change is in.

https://github.com/llvm/llvm-project/pull/92328


More information about the lldb-commits mailing list