https://github.com/jeffreytan81 updated https://github.com/llvm/llvm-project/pull/70231
>From c8d9a1f7387e3e4944d92ccb33699b6a9d0dcf89 Mon Sep 17 00:00:00 2001 From: jeffreytan81 <jeffrey...@fb.com> Date: Wed, 25 Oct 2023 10:21:06 -0700 Subject: [PATCH 1/2] Improve debug names index fetching global variables performance --- .../Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp index 292ea2806c59dc7..f94491b29bdbe14 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -130,6 +130,17 @@ void DebugNamesDWARFIndex::GetGlobalVariables( uint64_t cu_offset = cu.GetOffset(); bool found_entry_for_cu = false; for (const DebugNames::NameIndex &ni: *m_debug_names_up) { + // Check if this name index contains an entry for the given CU. + bool has_match_cu = false; + for (uint32_t i = 0;i < ni.getCUCount();++i) { + if (ni.getCUOffset(i) == cu_offset) { + has_match_cu = true; + break; + } + } + if (!has_match_cu) + continue; + for (DebugNames::NameTableEntry nte: ni) { uint64_t entry_offset = nte.getEntryOffset(); llvm::Expected<DebugNames::Entry> entry_or = ni.getEntry(&entry_offset); >From 19b7055e813471728f95ca42efcd4802261f2ea3 Mon Sep 17 00:00:00 2001 From: jeffreytan81 <jeffrey...@fb.com> Date: Wed, 25 Oct 2023 11:15:14 -0700 Subject: [PATCH 2/2] Address formatter/review feedback --- .../SymbolFile/DWARF/DebugNamesDWARFIndex.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp index f94491b29bdbe14..4fc3866a3b608fd 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -129,19 +129,19 @@ 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 (const DebugNames::NameIndex &ni : *m_debug_names_up) { // Check if this name index contains an entry for the given CU. - bool has_match_cu = false; - for (uint32_t i = 0;i < ni.getCUCount();++i) { + bool cu_matches = false; + for (uint32_t i = 0; i < ni.getCUCount(); ++i) { if (ni.getCUOffset(i) == cu_offset) { - has_match_cu = true; + cu_matches = true; break; } } - if (!has_match_cu) + if (!cu_matches) continue; - for (DebugNames::NameTableEntry nte: ni) { + for (DebugNames::NameTableEntry nte : ni) { uint64_t entry_offset = nte.getEntryOffset(); llvm::Expected<DebugNames::Entry> entry_or = ni.getEntry(&entry_offset); for (; entry_or; entry_or = ni.getEntry(&entry_offset)) { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits