This patchset is removing dependency on DWARFDIE's DWARFUnit *m_cu for stuff which is unavailable in DW_TAG_partial_unit without accessing its parent DW_TAG_compile_unit (which includes DW_TAG_partial_unit by DW_AT_import).
This patch has no regressions but to really make it usable for DWZ one still needs to adjust DWARFBaseDIE::GetDIERef() as one cannot generate DIERef (containing main unit idenitifier for DWZ) purely from DWARFDIE (not containing DWARFUnit *main_cu).
Refactored DWARFBaseDIE::GetDIERef() (adding some parameter) would then need adjustment also of functions calling it directly - DWARFBaseDIE::GetID() and SymbolFileDWARF::GetUID(const DWARFBaseDIE &die) (and many functions calling these).
I do not plan to check it in yet. I plan to finish it for use by DWZ patchset first (D40474 et al.). Asking whether this is a good way forward.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lldb/include/lldb/Symbol/TypeSystem.h | ||
---|---|---|
108–110 | This part looks pretty dodgy. I'd like to avoid introducing plugin references in non-plugin code. It looks like this class isn't particularly clean already (DWARFDIE forward decl), but this seems to make the problem much worse. Since this class already contains a SymbolFile pointer, maybe we could create some kind of a ast-parser constructing method on the SymbolFile class to avoid mentioning the SymbolFileDWARF directly. If I was doing this, I'd probably try to take this one step further and merge the GetDWARFParser/GetPDBParser methods (whose only calls are in the relevant symbol file plugins) into a single GetASTParser method and do appropriate casts in the plugins themselves. |
lldb/include/lldb/Symbol/TypeSystem.h | ||
---|---|---|
108–110 | TBH I did not do the described refactoring, I just used the existing m_sym_file. |
I tried to use DIERef instead of DWARFDIE everywhere as @labath does not like to increase DWARFDIE size from 16 bytes to 24 bytes. But that is not really feasible. For DIERef one needs to also carry SymbolFileDWARF * along and also resolving DIERef into DWARFDIE is slow as it has to bisect CUs from the DIE offset. I will post a different proposal how to implement DWZ.
This part looks pretty dodgy. I'd like to avoid introducing plugin references in non-plugin code. It looks like this class isn't particularly clean already (DWARFDIE forward decl), but this seems to make the problem much worse.
Since this class already contains a SymbolFile pointer, maybe we could create some kind of a ast-parser constructing method on the SymbolFile class to avoid mentioning the SymbolFileDWARF directly.
If I was doing this, I'd probably try to take this one step further and merge the GetDWARFParser/GetPDBParser methods (whose only calls are in the relevant symbol file plugins) into a single GetASTParser method and do appropriate casts in the plugins themselves.