diff options
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index ffab5e5eb60..98c782caed8 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -32,28 +32,30 @@ void ManualDWARFIndex::Index() { static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "%p", static_cast<void *>(&debug_info)); - const uint32_t num_compile_units = debug_info.GetNumCompileUnits(); - if (num_compile_units == 0) + std::vector<DWARFUnit *> units_to_index; + units_to_index.reserve(debug_info.GetNumCompileUnits()); + for (size_t U = 0; U < debug_info.GetNumCompileUnits(); ++U) { + DWARFUnit *unit = debug_info.GetCompileUnitAtIndex(U); + if (unit && m_units_to_avoid.count(unit->GetOffset()) == 0) + units_to_index.push_back(unit); + } + if (units_to_index.empty()) return; - std::vector<IndexSet> sets(num_compile_units); + std::vector<IndexSet> sets(units_to_index.size()); //---------------------------------------------------------------------- // Keep memory down by clearing DIEs for any compile units if indexing // caused us to load the compile unit's DIEs. //---------------------------------------------------------------------- - std::vector<llvm::Optional<DWARFUnit::ScopedExtractDIEs>> - clear_cu_dies(num_compile_units); + std::vector<llvm::Optional<DWARFUnit::ScopedExtractDIEs>> clear_cu_dies( + units_to_index.size()); auto parser_fn = [&](size_t cu_idx) { - DWARFUnit *dwarf_cu = debug_info.GetCompileUnitAtIndex(cu_idx); - if (dwarf_cu) - IndexUnit(*dwarf_cu, sets[cu_idx]); + IndexUnit(*units_to_index[cu_idx], sets[cu_idx]); }; - auto extract_fn = [&debug_info, &clear_cu_dies](size_t cu_idx) { - DWARFUnit *dwarf_cu = debug_info.GetCompileUnitAtIndex(cu_idx); - if (dwarf_cu) - clear_cu_dies[cu_idx] = dwarf_cu->ExtractDIEsScoped(); + auto extract_fn = [&units_to_index, &clear_cu_dies](size_t cu_idx) { + clear_cu_dies[cu_idx] = units_to_index[cu_idx]->ExtractDIEsScoped(); }; // Create a task runner that extracts dies for each DWARF compile unit in a @@ -66,12 +68,12 @@ void ManualDWARFIndex::Index() { // to wait until all compile units have been indexed in case a DIE in one // compile unit refers to another and the indexes accesses those DIEs. //---------------------------------------------------------------------- - TaskMapOverInt(0, num_compile_units, extract_fn); + TaskMapOverInt(0, units_to_index.size(), extract_fn); // Now create a task runner that can index each DWARF compile unit in a // separate thread so we can index quickly. - TaskMapOverInt(0, num_compile_units, parser_fn); + TaskMapOverInt(0, units_to_index.size(), parser_fn); auto finalize_fn = [this, &sets](NameToDIE(IndexSet::*index)) { NameToDIE &result = m_set.*index; |

