[Lldb-commits] [lldb] 8b259fe - [lldb] Trust the arange accelerator tables in dSYMs

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 9 14:35:04 PST 2023


Author: Jonas Devlieghere
Date: 2023-01-09T14:34:57-08:00
New Revision: 8b259fe573e109ea03c91aca34d5bd60f1a432ff

URL: https://github.com/llvm/llvm-project/commit/8b259fe573e109ea03c91aca34d5bd60f1a432ff
DIFF: https://github.com/llvm/llvm-project/commit/8b259fe573e109ea03c91aca34d5bd60f1a432ff.diff

LOG: [lldb] Trust the arange accelerator tables in dSYMs

When ingesting aranges from a dSYM, always trust the contents of the
accelerator table since it always comes from dsymutil.

According to Instruments, skipping the decoding of all CU DIEs to get at
the DW_AT_ranges attribute removes ~3.5 seconds from setting a
breakpoint by file/line when debugging clang with a dSYM. Interestingly
on the wall clock the speedup is less noticeable, but still present.

rdar://problem/56057688

Differential Revision: https://reviews.llvm.org/D68655

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 8933b0804a01..47f9672ba596 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -53,13 +53,20 @@ const DWARFDebugAranges &DWARFDebugInfo::GetCompileUnitAranges() {
   }
 
   // Manually build arange data for everything that wasn't in .debug_aranges.
-  const size_t num_units = GetNumUnits();
-  for (size_t idx = 0; idx < num_units; ++idx) {
-    DWARFUnit *cu = GetUnitAtIndex(idx);
-
-    dw_offset_t offset = cu->GetOffset();
-    if (cus_with_data.find(offset) == cus_with_data.end())
-      cu->BuildAddressRangeTable(m_cu_aranges_up.get());
+  // Skip this step for dSYMs as we can trust dsymutil to have emitted complete
+  // aranges.
+  const bool is_dsym =
+      m_dwarf.GetObjectFile() &&
+      m_dwarf.GetObjectFile()->GetType() == ObjectFile::eTypeDebugInfo;
+  if (!is_dsym) {
+    const size_t num_units = GetNumUnits();
+    for (size_t idx = 0; idx < num_units; ++idx) {
+      DWARFUnit *cu = GetUnitAtIndex(idx);
+
+      dw_offset_t offset = cu->GetOffset();
+      if (cus_with_data.find(offset) == cus_with_data.end())
+        cu->BuildAddressRangeTable(m_cu_aranges_up.get());
+    }
   }
 
   const bool minimize = true;


        


More information about the lldb-commits mailing list