[Lldb-commits] [PATCH] D73782: [lldb/DWARF] Don't hold a unique SymbolFileDWARFDwo in a DWARFUnit

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 6 08:32:56 PST 2020


labath marked 4 inline comments as done.
labath added inline comments.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp:56
+    return nullptr;
+  if (hash != cu->GetUnitDIEOnly().GetAttributeValueAsUnsigned(DW_AT_GNU_dwo_id, 0))
+    return nullptr;
----------------
clayborg wrote:
> How often does this function get called? Should we cache the DW_AT_GNU_dwo_id in the DWARFCompileUnit to avoid extracting the DW_AT_GNU_dwo_id attribute maybe multiple times? 
In a dwo file, this function will be called exactly once. With a DWP file (the next patch) it will get called once for each compile unit, but it will return a different compile unit each time, so for a single compile unit, the dwo_id attribute will still be accessed only once.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h:67
   SymbolFileDWARF &GetBaseSymbolFile() { return m_base_symbol_file; }
 
+  DWARFCompileUnit *FindSingleCompileUnit();
----------------
clayborg wrote:
> Curious: what is a single compile unit? A bit of a comment in header doc here might be nice.
I've added a simple comment. The idea is that a dwo file will normally(*) contain exactly one compile unit. This function will find it and return it.

(*) This may not be 100% as I believe llvm can produce multiple CUs in a dwo file under some circumstances, but I'm not sure if this is fully conforming, and it is definitely not something that works in lldb right now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73782/new/

https://reviews.llvm.org/D73782





More information about the lldb-commits mailing list