Skip to content

Commit 85cb8cc

Browse files
committed
[lldb] Do not parse symtab during statistics dump
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D73218490
1 parent 69b9ddc commit 85cb8cc

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

lldb/include/lldb/Symbol/ObjectFile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
319319
///
320320
/// \return
321321
/// The symbol table for this object file.
322-
Symtab *GetSymtab();
322+
Symtab *GetSymtab(bool can_create = true);
323323

324324
/// Parse the symbol table into the provides symbol table object.
325325
///

lldb/include/lldb/Symbol/SymbolFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class SymbolFile : public PluginInterface {
144144
virtual uint32_t GetNumCompileUnits() = 0;
145145
virtual lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx) = 0;
146146

147-
virtual Symtab *GetSymtab() = 0;
147+
virtual Symtab *GetSymtab(bool can_create = true) = 0;
148148

149149
virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) = 0;
150150
/// Return the Xcode SDK comp_unit was compiled against.
@@ -533,7 +533,7 @@ class SymbolFileCommon : public SymbolFile {
533533
return m_abilities;
534534
}
535535

536-
Symtab *GetSymtab() override;
536+
Symtab *GetSymtab(bool can_create = true) override;
537537

538538
ObjectFile *GetObjectFile() override { return m_objfile_sp.get(); }
539539
const ObjectFile *GetObjectFile() const override {

lldb/include/lldb/Symbol/SymbolFileOnDemand.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile {
186186

187187
uint32_t GetAbilities() override;
188188

189-
Symtab *GetSymtab() override { return m_sym_file_impl->GetSymtab(); }
189+
Symtab *GetSymtab(bool can_create = true) override { return m_sym_file_impl->GetSymtab(can_create); }
190190

191191
ObjectFile *GetObjectFile() override {
192192
return m_sym_file_impl->GetObjectFile();

lldb/source/Core/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ SymbolFile *Module::GetSymbolFile(bool can_create, Stream *feedback_strm) {
997997

998998
Symtab *Module::GetSymtab(bool can_create) {
999999
if (SymbolFile *symbols = GetSymbolFile(can_create))
1000-
return symbols->GetSymtab();
1000+
return symbols->GetSymtab(can_create);
10011001
return nullptr;
10021002
}
10031003

lldb/source/Symbol/ObjectFile.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,9 +735,9 @@ void llvm::format_provider<ObjectFile::Strata>::format(
735735
}
736736

737737

738-
Symtab *ObjectFile::GetSymtab() {
738+
Symtab *ObjectFile::GetSymtab(bool can_create) {
739739
ModuleSP module_sp(GetModule());
740-
if (module_sp) {
740+
if (module_sp && can_create) {
741741
// We can't take the module lock in ObjectFile::GetSymtab() or we can
742742
// deadlock in DWARF indexing when any file asks for the symbol table from
743743
// an object file. This currently happens in the preloading of symbols in

lldb/source/Symbol/SymbolFile.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ void SymbolFile::AssertModuleLock() {
152152

153153
SymbolFile::RegisterInfoResolver::~RegisterInfoResolver() = default;
154154

155-
Symtab *SymbolFileCommon::GetSymtab() {
155+
Symtab *SymbolFileCommon::GetSymtab(bool can_create) {
156156
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
157157
// Fetch the symtab from the main object file.
158-
auto *symtab = GetMainObjectFile()->GetSymtab();
158+
auto *symtab = GetMainObjectFile()->GetSymtab(can_create);
159159
if (m_symtab != symtab) {
160160
m_symtab = symtab;
161161

0 commit comments

Comments
 (0)