[Lldb-commits] [PATCH] D39825: [lldb] Fix cu_offset for dwo/dwp used by DWARFCompileUnit::Index

Tamas Berghammer via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 9 11:19:27 PST 2017


tberghammer added a comment.

In https://reviews.llvm.org/D39825#920739, @alexshap wrote:

> @tberghammer, SymbolFileDWARF (the base class of SymbolFileDWARFDwo) calls Index()
>  "lazily" in may places, so indexing of dwo happens almost inevitably (at the moment) 
>  (FindCompleteObjCDefinitionTypeForDIE  is just one example).


The main point is that you should almost always interact with the SymbolFileDWARF instance belonging to the main object file and it (actually DWARFCompileUnit) will know when to access data from the Dwo file instead. The original goal was to not leak pointers to SymbolFileDWARFDwo instances out from symbol file dwarf and the dwarf parsing logic.

>> because this way you will index the compile unit twice (once from the main object file and once from the dwo), 
>> then create 2 CompilerType for the 2 indexed version and will start hitting random issues in 
>> expression evaluation when clang will get confused by 2 declaration for the same type.
> 
> there are two separate CompileUnits here, not one,
>  There is a compile unit represented by m_base_dwarf_cu (roughly speaking for .o) and and there is another one
>  (which we can get, for example, via SymbolFileDWARFDwo::GetCompileUnit()) (roughly speaking for dwo).
>  (please, correct me if i'm wrong). For the latter GetOffset() would typically return 0, 
>  for the former GetOffset() typically returns the higher 32 bits of Id.

We have 2 DWARFCompileUnit but actually they belong to the same "compile time compile unit" so when you call Index on the one in the main object file (SymbolFileDWARF instance) it will read the data in from the Dwo file as well, add that data into its index and create some stub types in clang (they will be filled in later lazily).


Repository:
  rL LLVM

https://reviews.llvm.org/D39825





More information about the lldb-commits mailing list