[Lldb-commits] [lldb] 2e9853e - [DWARF5] Only fallback to manual index if no entry was found

Jan Kratochvil via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 29 07:17:12 PDT 2021


Author: Kim-Anh Tran
Date: 2021-07-29T16:16:42+02:00
New Revision: 2e9853e0e9ff263a948ebef70221fd0cec9c4830

URL: https://github.com/llvm/llvm-project/commit/2e9853e0e9ff263a948ebef70221fd0cec9c4830
DIFF: https://github.com/llvm/llvm-project/commit/2e9853e0e9ff263a948ebef70221fd0cec9c4830.diff

LOG: [DWARF5] Only fallback to manual index if no entry was found

If we succeed at gathering global variables for a compile
unit, there is no need to fallback to generating a manual index.

Reviewed By: jankratochvil

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index cb3e662a6cdfe..5dfa5a176d384 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -125,6 +125,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
 void DebugNamesDWARFIndex::GetGlobalVariables(
     const DWARFUnit &cu, llvm::function_ref<bool(DWARFDIE die)> callback) {
   uint64_t cu_offset = cu.GetOffset();
+  bool found_entry_for_cu = false;
   for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
     for (DebugNames::NameTableEntry nte: ni) {
       uint64_t entry_offset = nte.getEntryOffset();
@@ -135,6 +136,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
         if (entry_or->getCUOffset() != cu_offset)
           continue;
 
+        found_entry_for_cu = true;
         if (!ProcessEntry(*entry_or, callback,
                           llvm::StringRef(nte.getString())))
           return;
@@ -142,8 +144,10 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
       MaybeLogLookupError(entry_or.takeError(), ni, nte.getString());
     }
   }
-
-  m_fallback.GetGlobalVariables(cu, callback);
+  // If no name index for that particular CU was found, fallback to
+  // creating the manual index.
+  if (!found_entry_for_cu)
+    m_fallback.GetGlobalVariables(cu, callback);
 }
 
 void DebugNamesDWARFIndex::GetCompleteObjCClass(


        


More information about the lldb-commits mailing list