Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/Timer.h"
#include "lldb/lldb-private-enumerations.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/ThreadPool.h"
#include <atomic>
#include <optional>
Expand All @@ -33,10 +32,10 @@ using namespace lldb_private::plugin::dwarf;
using namespace llvm::dwarf;

void ManualDWARFIndex::Index() {
if (m_indexed)
return;
m_indexed = true;
std::call_once(m_indexed_flag, [this]() { IndexImpl(); });
}

void ManualDWARFIndex::IndexImpl() {
ElapsedTime elapsed(m_index_time);
LLDB_SCOPED_TIMERF("%p", static_cast<void *>(m_dwarf));
if (LoadFromCache()) {
Expand Down
8 changes: 7 additions & 1 deletion lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ class ManualDWARFIndex : public DWARFIndex {
void Dump(Stream &s) override;

private:
/// Reads the DWARF debug info to build the index once.
///
/// Should be called before attempting to retrieve symbols.
void Index();

/// Call `ManualDWARFIndex::Index()` instead.
void IndexImpl();

/// Decode a serialized version of this object from data.
///
/// \param data
Expand Down Expand Up @@ -170,7 +176,7 @@ class ManualDWARFIndex : public DWARFIndex {
llvm::DenseSet<uint64_t> m_type_sigs_to_avoid;

IndexSet<NameToDIE> m_set;
bool m_indexed = false;
std::once_flag m_indexed_flag;
};
} // namespace dwarf
} // namespace lldb_private::plugin
Expand Down
Loading