[Lldb-commits] [PATCH] D106355: [DWARF5] Only fallback to manual index if no entry was found
Kim-Anh Tran via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 20 04:37:38 PDT 2021
kimanh created this revision.
Herald added a subscriber: arphaman.
kimanh updated this revision to Diff 360084.
kimanh added a comment.
kimanh retitled this revision from "[Index] Only fallback to manual index if no entry was found" to "[DWARF5] Only fallback to manual index if no entry was found".
kimanh added a reviewer: labath.
kimanh added a subscriber: pfaffe.
kimanh published this revision for review.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Minor: rename variable
kimanh added a comment.
Hello Pavel,
we are currently looking at the usage of the .debug_names section. For `DebugNamesDWARFIndex::GetGlobalVariables(DWARFUnit &cu, llvm::function_ref<bool(DWARFDIE die)> callback)` we do not see a clear reason why one would need to still call the fallback. In this case, we only look at that particular CU, and if there's already a name index for that CU, going through the name index should be enough? If we are missing something, please let us know! Otherwise, here is a CL that would only conditionally create the manual index.
If we succeed at gathering global variables for a compile
unit, there is no need to fallback to generating a manual index.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D106355
Files:
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
Index: lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -125,6 +125,7 @@
void DebugNamesDWARFIndex::GetGlobalVariables(
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 @@
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,11 @@
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(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106355.360084.patch
Type: text/x-patch
Size: 1302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210720/398c369b/attachment.bin>
More information about the lldb-commits
mailing list