summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-06-07 10:35:28 +0000
committerPavel Labath <labath@google.com>2018-06-07 10:35:28 +0000
commit452bd87cc478f4d017c5c11bb409287335f40f30 (patch)
treea6d29789b10abdc97554509b7994f40d16031777 /lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
parent697300bd4f94d79f51f4a496bec7bde93661f7f1 (diff)
downloadbcm5719-llvm-452bd87cc478f4d017c5c11bb409287335f40f30.tar.gz
bcm5719-llvm-452bd87cc478f4d017c5c11bb409287335f40f30.zip
DebugNamesDWARFIndex: Add support for partial indexes
Summary: It possible that a single module has indexed and non-indexed compile units. In this case, we can use the fast indexed lookup for the first ones and fall back to the manual index for the others. This patch implements this functionality by adding a units_to_avoid argument to the ManualDWARFIndex constructor. Any units present in that list will be ignored for the purposes of manual index. Individual DebugNamesDWARFIndex then always consult both the manual fallback index as well as the index in the .debug_names section. Reviewers: JDevlieghere, clayborg Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47832 llvm-svn: 334185
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp30
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;
OpenPOWER on IntegriCloud