[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue May 21 10:29:46 PDT 2024
================
@@ -2306,6 +2345,11 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die,
if (!die)
return false;
+ ParsedDWARFTypeAttributes attrs(die);
----------------
labath wrote:
> > Why don't those cases lead to a crash? For example, what would happen if the name was simply not in the index?
>
> That is specific to debug_names because the index gives us a declaration DIE when we are searching for definition DIE in 'FindDefinitionTypeForDWARFDeclContext'. Before, we didn't have the extra check, so we tries to complete the type from declaration DIE, which triggers an assertion in clang. However, it doesn't happen in manual index because we already explicitly checked `DW_AT_declaration` attributes when creating the manual index. It's guaranteed to find a definition DIE from `FindDefinitionTypeForDWARFDeclContext` or nothing (early bailout, won't try to complete it).
Okay, so when I said "specific to debug_names", I was mainly thinking of the case where the index doesn't find anything (i.e., we attempt to complete a type and the index (any kind of index) says we can't, because it doesn't have the definition). Based on what you've said (and some more pondering), I think can now answer that question for myself (please let me know if this is wrong):
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).
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.
https://github.com/llvm/llvm-project/pull/92328
More information about the lldb-commits
mailing list