[Lldb-commits] [lldb] [lldb][SymbolFileDWARF] CompleteType: Lookup type in the declaration DIE's SymbolFile (PR #120569)

Zequan Wu via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 19 12:40:59 PST 2024


ZequanWu wrote:

> > > In which case, GetDIEToType().lookup(decl_die) will return a nullptr. This is already a bit iffy because some of the surrounding code assumes we don't call CompleteTypeFromDWARF with a nullptr Type*. E.g., CompleteEnumType blindly dereferences it (though enums will never encounter this because their definition is fetched in ParseEnum, unlike for structures).
> > 
> > 
> > Should we bail out early if the Type* is null and return false to tell `SymbolFileDWARFDebugMap::CompleteType` that it can not complete this type and let it iterate to the symbol file that has the entry in its map.
> 
> Yea that might be even simpler. Let me try that.
> 
> Also, the other crash i alluded to seems to come from the fact that `UniqueDWARFASTTypeList::Find` will compare `Declaration`s (i.e., line and col info) regardless of whether we're dealing with C++ or not. But `GetUniqueTypeNameAndDeclaration` will return a `0` `Declaration` for C++. So we can end up inserting the `Declaration` for a definition DIE into the map (via `UpdateToDefDIE`), but then try to retrieve it using a `0` `Declaration`. Should have a patch up for that soon (I think we can just skip the declaration check if we're dealing with C++?)

I agree that checking `Declaration` for C++ die isn't necessary, the unique name should be sufficient. I get that Declaration is cleared for all C++ die in `GetUniqueTypeNameAndDeclaration`, so they all have 0 declaration and checking on declaration will just always be true for C++ right? How does it cause a problem?

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


More information about the lldb-commits mailing list