}
void AppleDWARFIndex::GetGlobalVariables(
- ConstString basename, llvm::function_ref<bool(DIERef ref)> callback) {
+ ConstString basename, llvm::function_ref<bool(DWARFDIE die)> callback) {
if (!m_apple_names_up)
return;
- m_apple_names_up->FindByName(basename.GetStringRef(), callback);
+ m_apple_names_up->FindByName(
+ basename.GetStringRef(),
+ DIERefCallback(callback, basename.GetStringRef()));
}
void AppleDWARFIndex::GetGlobalVariables(
const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
if (!m_apple_names_up)
return;
DWARFMappedHash::DIEInfoArray hash_data;
m_apple_names_up->AppendAllDIEsThatMatchingRegex(regex, hash_data);
- DWARFMappedHash::ExtractDIEArray(hash_data, callback);
+ // This is not really the DIE name.
+ DWARFMappedHash::ExtractDIEArray(hash_data,
+ DIERefCallback(callback, regex.GetText()));
}
void AppleDWARFIndex::GetGlobalVariables(
- const DWARFUnit &cu, llvm::function_ref<bool(DIERef ref)> callback) {
+ const DWARFUnit &cu, llvm::function_ref<bool(DWARFDIE die)> callback) {
if (!m_apple_names_up)
return;
DWARFMappedHash::DIEInfoArray hash_data;
m_apple_names_up->AppendAllDIEsInRange(cu.GetOffset(), cu.GetNextUnitOffset(),
hash_data);
- DWARFMappedHash::ExtractDIEArray(hash_data, callback);
+ DWARFMappedHash::ExtractDIEArray(hash_data, DIERefCallback(callback));
}
void AppleDWARFIndex::GetObjCMethods(
- ConstString class_name, llvm::function_ref<bool(DIERef ref)> callback) {
+ ConstString class_name, llvm::function_ref<bool(DWARFDIE die)> callback) {
if (!m_apple_objc_up)
return;
- m_apple_objc_up->FindByName(class_name.GetStringRef(), callback);
+ m_apple_objc_up->FindByName(
+ class_name.GetStringRef(),
+ DIERefCallback(callback, class_name.GetStringRef()));
}
void AppleDWARFIndex::GetCompleteObjCClass(
ConstString class_name, bool must_be_implementation,
- llvm::function_ref<bool(DIERef ref)> callback) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
if (!m_apple_types_up)
return;
m_apple_types_up->FindCompleteObjCClassByName(
- class_name.GetStringRef(), callback, must_be_implementation);
+ class_name.GetStringRef(),
+ DIERefCallback(callback, class_name.GetStringRef()),
+ must_be_implementation);
}
-void AppleDWARFIndex::GetTypes(ConstString name,
- llvm::function_ref<bool(DIERef ref)> callback) {
+void AppleDWARFIndex::GetTypes(
+ ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
if (!m_apple_types_up)
return;
- m_apple_types_up->FindByName(name.GetStringRef(), callback);
+ m_apple_types_up->FindByName(name.GetStringRef(),
+ DIERefCallback(callback, name.GetStringRef()));
}
-void AppleDWARFIndex::GetTypes(const DWARFDeclContext &context,
- llvm::function_ref<bool(DIERef ref)> callback) {
+void AppleDWARFIndex::GetTypes(
+ const DWARFDeclContext &context,
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
if (!m_apple_types_up)
return;
if (log)
m_module.LogMessage(log, "FindByNameAndTagAndQualifiedNameHash()");
m_apple_types_up->FindByNameAndTagAndQualifiedNameHash(
- type_name.GetStringRef(), tag, qualified_name_hash, callback);
+ type_name.GetStringRef(), tag, qualified_name_hash,
+ DIERefCallback(callback, type_name.GetStringRef()));
return;
}
if (log)
m_module.LogMessage(log, "FindByNameAndTag()");
- m_apple_types_up->FindByNameAndTag(type_name.GetStringRef(), tag, callback);
+ m_apple_types_up->FindByNameAndTag(
+ type_name.GetStringRef(), tag,
+ DIERefCallback(callback, type_name.GetStringRef()));
return;
}
- m_apple_types_up->FindByName(type_name.GetStringRef(), callback);
+ m_apple_types_up->FindByName(
+ type_name.GetStringRef(),
+ DIERefCallback(callback, type_name.GetStringRef()));
}
void AppleDWARFIndex::GetNamespaces(
- ConstString name, llvm::function_ref<bool(DIERef ref)> callback) {
+ ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
if (!m_apple_namespaces_up)
return;
- m_apple_namespaces_up->FindByName(name.GetStringRef(), callback);
+ m_apple_namespaces_up->FindByName(
+ name.GetStringRef(), DIERefCallback(callback, name.GetStringRef()));
}
void AppleDWARFIndex::GetFunctions(
void AppleDWARFIndex::GetFunctions(
const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
if (!m_apple_names_up)
return;
DWARFMappedHash::DIEInfoArray hash_data;
m_apple_names_up->AppendAllDIEsThatMatchingRegex(regex, hash_data);
- DWARFMappedHash::ExtractDIEArray(hash_data, callback);
-}
-
-void AppleDWARFIndex::ReportInvalidDIERef(const DIERef &ref,
- llvm::StringRef name) {
- m_module.ReportErrorIfModifyDetected(
- "the DWARF debug information has been modified (accelerator table had "
- "bad die 0x%8.8x for '%s')\n",
- ref.die_offset(), name.str().c_str());
+ DWARFMappedHash::ExtractDIEArray(hash_data,
+ DIERefCallback(callback, regex.GetText()));
}
void AppleDWARFIndex::Dump(Stream &s) {
void
GetGlobalVariables(ConstString basename,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void
GetGlobalVariables(const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void
GetGlobalVariables(const DWARFUnit &cu,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetObjCMethods(ConstString class_name,
- llvm::function_ref<bool(DIERef ref)> callback) override;
- void
- GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
+ void GetCompleteObjCClass(
+ ConstString class_name, bool must_be_implementation,
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetTypes(ConstString name,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetTypes(const DWARFDeclContext &context,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetNamespaces(ConstString name,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetFunctions(ConstString name, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
uint32_t name_type_mask,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetFunctions(const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override;
void Dump(Stream &s) override;
private:
if (class_language == eLanguageTypeObjC) {
ConstString class_name(clang_type.GetTypeName());
if (class_name) {
- dwarf->GetObjCMethods(class_name, [&](DIERef die_ref) {
- DWARFDebugInfo &debug_info = dwarf->DebugInfo();
- DWARFDIE method_die = debug_info.GetDIE(die_ref);
- if (method_die)
- method_die.ResolveType();
+ dwarf->GetObjCMethods(class_name, [&](DWARFDIE method_die) {
+ method_die.ResolveType();
return true;
});
#include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
+#include "lldb/Core/Module.h"
+
using namespace lldb_private;
using namespace lldb;
return true;
}
+
+DWARFIndex::DIERefCallbackImpl::DIERefCallbackImpl(
+ const DWARFIndex &index, llvm::function_ref<bool(DWARFDIE die)> callback,
+ llvm::StringRef name)
+ : m_index(index),
+ m_dwarf(*llvm::cast<SymbolFileDWARF>(index.m_module.GetSymbolFile())),
+ m_callback(callback), m_name(name) {}
+
+bool DWARFIndex::DIERefCallbackImpl::operator()(DIERef ref) const {
+ if (DWARFDIE die = m_dwarf.GetDIE(ref))
+ return m_callback(die);
+ m_index.ReportInvalidDIERef(ref, m_name);
+ return true;
+}
+
+void DWARFIndex::ReportInvalidDIERef(DIERef ref, llvm::StringRef name) const {
+ m_module.ReportErrorIfModifyDetected(
+ "the DWARF debug information has been modified (accelerator table had "
+ "bad die 0x%8.8x for '%s')\n",
+ ref.die_offset(), name.str().c_str());
+}
/// the consumer.
virtual void
GetGlobalVariables(ConstString basename,
- llvm::function_ref<bool(DIERef ref)> callback) = 0;
+ llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
virtual void
GetGlobalVariables(const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) = 0;
+ llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
virtual void
GetGlobalVariables(const DWARFUnit &cu,
- llvm::function_ref<bool(DIERef ref)> callback) = 0;
+ llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
virtual void
GetObjCMethods(ConstString class_name,
- llvm::function_ref<bool(DIERef ref)> callback) = 0;
+ llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
virtual void
GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
- llvm::function_ref<bool(DIERef ref)> callback) = 0;
+ llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
virtual void GetTypes(ConstString name,
- llvm::function_ref<bool(DIERef ref)> callback) = 0;
+ llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
virtual void GetTypes(const DWARFDeclContext &context,
- llvm::function_ref<bool(DIERef ref)> callback) = 0;
- virtual void GetNamespaces(ConstString name,
- llvm::function_ref<bool(DIERef ref)> callback) = 0;
+ llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
+ virtual void
+ GetNamespaces(ConstString name,
+ llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
virtual void
GetFunctions(ConstString name, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
uint32_t name_type_mask,
llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
- virtual void GetFunctions(const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) = 0;
+ virtual void
+ GetFunctions(const RegularExpression ®ex,
+ llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
- virtual void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) = 0;
virtual void Dump(Stream &s) = 0;
protected:
const CompilerDeclContext &parent_decl_ctx,
uint32_t name_type_mask,
llvm::function_ref<bool(DWARFDIE die)> callback);
+
+ class DIERefCallbackImpl {
+ public:
+ DIERefCallbackImpl(const DWARFIndex &index,
+ llvm::function_ref<bool(DWARFDIE die)> callback,
+ llvm::StringRef name);
+ bool operator()(DIERef ref) const;
+
+ private:
+ const DWARFIndex &m_index;
+ SymbolFileDWARF &m_dwarf;
+ const llvm::function_ref<bool(DWARFDIE die)> m_callback;
+ const llvm::StringRef m_name;
+ };
+ DIERefCallbackImpl
+ DIERefCallback(llvm::function_ref<bool(DWARFDIE die)> callback,
+ llvm::StringRef name = {}) const {
+ return DIERefCallbackImpl(*this, callback, name);
+ }
+
+ void ReportInvalidDIERef(DIERef ref, llvm::StringRef name) const;
};
} // namespace lldb_private
#include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
#include "Plugins/SymbolFile/DWARF/DWARFDeclContext.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h"
+#include "lldb/Core/Module.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
bool DebugNamesDWARFIndex::ProcessEntry(
const DebugNames::Entry &entry,
- llvm::function_ref<bool(DIERef ref)> callback) {
- if (llvm::Optional<DIERef> ref = ToDIERef(entry))
- return callback(*ref);
- return true;
+ llvm::function_ref<bool(DWARFDIE die)> callback, llvm::StringRef name) {
+ llvm::Optional<DIERef> ref = ToDIERef(entry);
+ if (!ref)
+ return true;
+ SymbolFileDWARF &dwarf =
+ *llvm::cast<SymbolFileDWARF>(m_module.GetSymbolFile());
+ DWARFDIE die = dwarf.GetDIE(*ref);
+ if (!die)
+ return true;
+ return callback(die);
}
void DebugNamesDWARFIndex::MaybeLogLookupError(llvm::Error error,
}
void DebugNamesDWARFIndex::GetGlobalVariables(
- ConstString basename, llvm::function_ref<bool(DIERef ref)> callback) {
+ ConstString basename, llvm::function_ref<bool(DWARFDIE die)> callback) {
for (const DebugNames::Entry &entry :
m_debug_names_up->equal_range(basename.GetStringRef())) {
if (entry.tag() != DW_TAG_variable)
continue;
- if (!ProcessEntry(entry, callback))
+ if (!ProcessEntry(entry, callback, basename.GetStringRef()))
return;
}
void DebugNamesDWARFIndex::GetGlobalVariables(
const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
for (DebugNames::NameTableEntry nte: ni) {
if (!regex.Execute(nte.getString()))
if (entry_or->tag() != DW_TAG_variable)
continue;
- if (!ProcessEntry(*entry_or, callback))
+ if (!ProcessEntry(*entry_or, callback,
+ llvm::StringRef(nte.getString())))
return;
}
MaybeLogLookupError(entry_or.takeError(), ni, nte.getString());
}
void DebugNamesDWARFIndex::GetGlobalVariables(
- const DWARFUnit &cu, llvm::function_ref<bool(DIERef ref)> callback) {
+ const DWARFUnit &cu, llvm::function_ref<bool(DWARFDIE die)> callback) {
uint64_t cu_offset = cu.GetOffset();
for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
for (DebugNames::NameTableEntry nte: ni) {
if (entry_or->getCUOffset() != cu_offset)
continue;
- if (!ProcessEntry(*entry_or, callback))
+ if (!ProcessEntry(*entry_or, callback,
+ llvm::StringRef(nte.getString())))
return;
}
MaybeLogLookupError(entry_or.takeError(), ni, nte.getString());
void DebugNamesDWARFIndex::GetCompleteObjCClass(
ConstString class_name, bool must_be_implementation,
- llvm::function_ref<bool(DIERef ref)> callback) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
// Keep a list of incomplete types as fallback for when we don't find the
// complete type.
DIEArray incomplete_types;
continue;
}
- // FIXME: We should return DWARFDIEs so we don't have to resolve it twice.
DWARFDIE die = m_debug_info.GetDIE(*ref);
- if (!die)
+ if (!die) {
+ ReportInvalidDIERef(*ref, class_name.GetStringRef());
continue;
+ }
if (die.GetAttributeValueAsUnsigned(DW_AT_APPLE_objc_complete_type, 0)) {
// If we find the complete version we're done.
- callback(*ref);
+ callback(die);
return;
}
incomplete_types.push_back(*ref);
}
+ auto dierefcallback = DIERefCallback(callback, class_name.GetStringRef());
for (DIERef ref : incomplete_types)
- if (!callback(ref))
+ if (!dierefcallback(ref))
return;
m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, callback);
}
void DebugNamesDWARFIndex::GetTypes(
- ConstString name, llvm::function_ref<bool(DIERef ref)> callback) {
+ ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
for (const DebugNames::Entry &entry :
m_debug_names_up->equal_range(name.GetStringRef())) {
if (isType(entry.tag())) {
- if (!ProcessEntry(entry, callback))
+ if (!ProcessEntry(entry, callback, name.GetStringRef()))
return;
}
}
void DebugNamesDWARFIndex::GetTypes(
const DWARFDeclContext &context,
- llvm::function_ref<bool(DIERef ref)> callback) {
- for (const DebugNames::Entry &entry :
- m_debug_names_up->equal_range(context[0].name)) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
+ auto name = context[0].name;
+ for (const DebugNames::Entry &entry : m_debug_names_up->equal_range(name)) {
if (entry.tag() == context[0].tag) {
- if (!ProcessEntry(entry, callback))
+ if (!ProcessEntry(entry, callback, name))
return;
}
}
}
void DebugNamesDWARFIndex::GetNamespaces(
- ConstString name, llvm::function_ref<bool(DIERef ref)> callback) {
+ ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
for (const DebugNames::Entry &entry :
m_debug_names_up->equal_range(name.GetStringRef())) {
if (entry.tag() == DW_TAG_namespace) {
- if (!ProcessEntry(entry, callback))
+ if (!ProcessEntry(entry, callback, name.GetStringRef()))
return;
}
}
void DebugNamesDWARFIndex::GetFunctions(
const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
for (DebugNames::NameTableEntry nte: ni) {
if (!regex.Execute(nte.getString()))
if (tag != DW_TAG_subprogram && tag != DW_TAG_inlined_subroutine)
continue;
- if (!ProcessEntry(*entry_or, callback))
+ if (!ProcessEntry(*entry_or, callback,
+ llvm::StringRef(nte.getString())))
return;
}
MaybeLogLookupError(entry_or.takeError(), ni, nte.getString());
void
GetGlobalVariables(ConstString basename,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void
GetGlobalVariables(const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void
GetGlobalVariables(const DWARFUnit &cu,
- llvm::function_ref<bool(DIERef ref)> callback) override;
- void GetObjCMethods(ConstString class_name,
- llvm::function_ref<bool(DIERef ref)> callback) override {}
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void
- GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ GetObjCMethods(ConstString class_name,
+ llvm::function_ref<bool(DWARFDIE die)> callback) override {}
+ void GetCompleteObjCClass(
+ ConstString class_name, bool must_be_implementation,
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetTypes(ConstString name,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetTypes(const DWARFDeclContext &context,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetNamespaces(ConstString name,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetFunctions(ConstString name, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
uint32_t name_type_mask,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetFunctions(const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override {}
void Dump(Stream &s) override;
private:
llvm::Optional<DIERef> ToDIERef(const DebugNames::Entry &entry);
bool ProcessEntry(const DebugNames::Entry &entry,
- llvm::function_ref<bool(DIERef ref)> callback);
+ llvm::function_ref<bool(DWARFDIE die)> callback,
+ llvm::StringRef name);
static void MaybeLogLookupError(llvm::Error error,
const DebugNames::NameIndex &ni,
}
void ManualDWARFIndex::GetGlobalVariables(
- ConstString basename, llvm::function_ref<bool(DIERef ref)> callback) {
+ ConstString basename, llvm::function_ref<bool(DWARFDIE die)> callback) {
Index();
- m_set.globals.Find(basename, callback);
+ m_set.globals.Find(basename,
+ DIERefCallback(callback, basename.GetStringRef()));
}
void ManualDWARFIndex::GetGlobalVariables(
const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
Index();
- m_set.globals.Find(regex, callback);
+ m_set.globals.Find(regex, DIERefCallback(callback, regex.GetText()));
}
void ManualDWARFIndex::GetGlobalVariables(
- const DWARFUnit &unit, llvm::function_ref<bool(DIERef ref)> callback) {
+ const DWARFUnit &unit, llvm::function_ref<bool(DWARFDIE die)> callback) {
Index();
- m_set.globals.FindAllEntriesForUnit(unit, callback);
+ m_set.globals.FindAllEntriesForUnit(unit, DIERefCallback(callback));
}
void ManualDWARFIndex::GetObjCMethods(
- ConstString class_name, llvm::function_ref<bool(DIERef ref)> callback) {
+ ConstString class_name, llvm::function_ref<bool(DWARFDIE die)> callback) {
Index();
- m_set.objc_class_selectors.Find(class_name, callback);
+ m_set.objc_class_selectors.Find(
+ class_name, DIERefCallback(callback, class_name.GetStringRef()));
}
void ManualDWARFIndex::GetCompleteObjCClass(
ConstString class_name, bool must_be_implementation,
- llvm::function_ref<bool(DIERef ref)> callback) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
Index();
- m_set.types.Find(class_name, callback);
+ m_set.types.Find(class_name,
+ DIERefCallback(callback, class_name.GetStringRef()));
}
-void ManualDWARFIndex::GetTypes(ConstString name,
- llvm::function_ref<bool(DIERef ref)> callback) {
+void ManualDWARFIndex::GetTypes(
+ ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
Index();
- m_set.types.Find(name, callback);
+ m_set.types.Find(name, DIERefCallback(callback, name.GetStringRef()));
}
-void ManualDWARFIndex::GetTypes(const DWARFDeclContext &context,
- llvm::function_ref<bool(DIERef ref)> callback) {
+void ManualDWARFIndex::GetTypes(
+ const DWARFDeclContext &context,
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
Index();
- m_set.types.Find(ConstString(context[0].name), callback);
+ auto name = context[0].name;
+ m_set.types.Find(ConstString(name),
+ DIERefCallback(callback, llvm::StringRef(name)));
}
void ManualDWARFIndex::GetNamespaces(
- ConstString name, llvm::function_ref<bool(DIERef ref)> callback) {
+ ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
Index();
- m_set.namespaces.Find(name, callback);
+ m_set.namespaces.Find(name, DIERefCallback(callback, name.GetStringRef()));
}
void ManualDWARFIndex::GetFunctions(
Index();
if (name_type_mask & eFunctionNameTypeFull) {
- if (!m_set.function_fullnames.Find(name, [&](DIERef die_ref) {
- DWARFDIE die = dwarf.GetDIE(die_ref);
- if (!die)
- return true;
- if (!SymbolFileDWARF::DIEInDeclContext(parent_decl_ctx, die))
- return true;
- return callback(die);
- }))
+ if (!m_set.function_fullnames.Find(
+ name, DIERefCallback(
+ [&](DWARFDIE die) {
+ if (!SymbolFileDWARF::DIEInDeclContext(parent_decl_ctx,
+ die))
+ return true;
+ return callback(die);
+ },
+ name.GetStringRef())))
return;
}
if (name_type_mask & eFunctionNameTypeBase) {
- if (!m_set.function_basenames.Find(name, [&](DIERef die_ref) {
- DWARFDIE die = dwarf.GetDIE(die_ref);
- if (!die)
- return true;
- if (!SymbolFileDWARF::DIEInDeclContext(parent_decl_ctx, die))
- return true;
- return callback(die);
- }))
+ if (!m_set.function_basenames.Find(
+ name, DIERefCallback(
+ [&](DWARFDIE die) {
+ if (!SymbolFileDWARF::DIEInDeclContext(parent_decl_ctx,
+ die))
+ return true;
+ return callback(die);
+ },
+ name.GetStringRef())))
return;
}
if (name_type_mask & eFunctionNameTypeMethod && !parent_decl_ctx.IsValid()) {
- if (!m_set.function_methods.Find(name, [&](DIERef die_ref) {
- DWARFDIE die = dwarf.GetDIE(die_ref);
- if (!die)
- return true;
- return callback(die);
- }))
+ if (!m_set.function_methods.Find(
+ name, DIERefCallback(callback, name.GetStringRef())))
return;
}
if (name_type_mask & eFunctionNameTypeSelector &&
!parent_decl_ctx.IsValid()) {
- if (!m_set.function_selectors.Find(name, [&](DIERef die_ref) {
- DWARFDIE die = dwarf.GetDIE(die_ref);
- if (!die)
- return true;
- return callback(die);
- }))
+ if (!m_set.function_selectors.Find(
+ name, DIERefCallback(callback, name.GetStringRef())))
return;
}
}
void ManualDWARFIndex::GetFunctions(
const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
Index();
- if (!m_set.function_basenames.Find(regex, callback))
+ if (!m_set.function_basenames.Find(regex,
+ DIERefCallback(callback, regex.GetText())))
return;
- if (!m_set.function_fullnames.Find(regex, callback))
+ if (!m_set.function_fullnames.Find(regex,
+ DIERefCallback(callback, regex.GetText())))
return;
}
void
GetGlobalVariables(ConstString basename,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void
GetGlobalVariables(const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void
GetGlobalVariables(const DWARFUnit &unit,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetObjCMethods(ConstString class_name,
- llvm::function_ref<bool(DIERef ref)> callback) override;
- void
- GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
+ void GetCompleteObjCClass(
+ ConstString class_name, bool must_be_implementation,
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetTypes(ConstString name,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetTypes(const DWARFDeclContext &context,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetNamespaces(ConstString name,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetFunctions(ConstString name, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
uint32_t name_type_mask,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetFunctions(const RegularExpression ®ex,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override {}
void Dump(Stream &s) override;
private:
}
void SymbolFileDWARF::GetObjCMethods(
- ConstString class_name, llvm::function_ref<bool(DIERef ref)> callback) {
+ ConstString class_name, llvm::function_ref<bool(DWARFDIE die)> callback) {
m_index->GetObjCMethods(class_name, callback);
}
uint32_t pruned_idx = original_size;
SymbolContext sc;
- m_index->GetGlobalVariables(ConstString(basename), [&](DIERef die_ref) {
+ m_index->GetGlobalVariables(ConstString(basename), [&](DWARFDIE die) {
if (!sc.module_sp)
sc.module_sp = m_objfile_sp->GetModule();
assert(sc.module_sp);
- DWARFDIE die = GetDIE(die_ref);
- if (!die) {
- m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
- return true;
- }
-
if (die.Tag() != DW_TAG_variable)
return true;
const uint32_t original_size = variables.GetSize();
SymbolContext sc;
- m_index->GetGlobalVariables(regex, [&](DIERef die_ref) {
+ m_index->GetGlobalVariables(regex, [&](DWARFDIE die) {
if (!sc.module_sp)
sc.module_sp = m_objfile_sp->GetModule();
assert(sc.module_sp);
- DWARFDIE die = GetDIE(die_ref);
- if (!die) {
- m_index->ReportInvalidDIERef(die_ref, regex.GetText());
- return true;
- }
-
DWARFCompileUnit *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(die.GetCU());
if (!dwarf_cu)
return true;
regex.GetText().str().c_str());
}
- DWARFDebugInfo &info = DebugInfo();
llvm::DenseSet<const DWARFDebugInfoEntry *> resolved_dies;
- m_index->GetFunctions(regex, [&](DIERef ref) {
- DWARFDIE die = info.GetDIE(ref);
- if (!die) {
- m_index->ReportInvalidDIERef(ref, regex.GetText());
- return true;
- }
+ m_index->GetFunctions(regex, [&](DWARFDIE die) {
if (resolved_dies.insert(die.GetDIE()).second)
ResolveFunction(die, include_inlines, sc_list);
return true;
if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
return;
- m_index->GetTypes(name, [&](DIERef die_ref) {
- DWARFDIE die = GetDIE(die_ref);
- if (!die) {
- m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
- return true;
- }
-
+ m_index->GetTypes(name, [&](DWARFDIE die) {
if (!DIEInDeclContext(parent_decl_ctx, die))
return true; // The containing decl contexts don't match
if (!name)
return;
- m_index->GetTypes(name, [&](DIERef die_ref) {
- DWARFDIE die = GetDIE(die_ref);
- if (!die) {
- m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
- return true;
- }
-
+ m_index->GetTypes(name, [&](DWARFDIE die) {
if (!languages[GetLanguage(*die.GetCU())])
return true;
if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
return namespace_decl_ctx;
- m_index->GetNamespaces(name, [&](DIERef die_ref) {
- DWARFDIE die = GetDIE(die_ref);
- if (!die) {
- m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
- return true;
- }
-
+ m_index->GetNamespaces(name, [&](DWARFDIE die) {
if (!DIEInDeclContext(parent_decl_ctx, die))
return true; // The containing decl contexts don't match
return type_sp;
m_index->GetCompleteObjCClass(
- type_name, must_be_implementation, [&](DIERef die_ref) {
- DWARFDIE type_die = GetDIE(die_ref);
- if (!type_die) {
- m_index->ReportInvalidDIERef(die_ref, type_name.GetStringRef());
- return true;
- }
-
+ type_name, must_be_implementation, [&](DWARFDIE type_die) {
bool try_resolving_type = false;
// Don't try and resolve the DIE we are looking for with the DIE
}
}
- m_index->GetTypes(dwarf_decl_ctx, [&](DIERef die_ref) {
- DWARFDIE type_die = GetDIE(die_ref);
- if (!type_die) {
- m_index->ReportInvalidDIERef(die_ref, type_name.GetStringRef());
- return true;
- }
-
+ m_index->GetTypes(dwarf_decl_ctx, [&](DWARFDIE type_die) {
// Make sure type_die's langauge matches the type system we are
// looking for. We don't want to find a "Foo" type from Java if we
// are looking for a "Foo" type for C, C++, ObjC, or ObjC++.
sc.comp_unit->SetVariableList(variables);
m_index->GetGlobalVariables(
- dwarf_cu->GetNonSkeletonUnit(), [&](DIERef die_ref) {
- DWARFDIE die = GetDIE(die_ref);
- if (!die) {
- m_index->ReportInvalidDIERef(die_ref, "");
- return true;
- }
+ dwarf_cu->GetNonSkeletonUnit(), [&](DWARFDIE die) {
VariableSP var_sp(
ParseVariableDIE(sc, die, LLDB_INVALID_ADDRESS));
if (var_sp) {
GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu);
virtual void GetObjCMethods(lldb_private::ConstString class_name,
- llvm::function_ref<bool(DIERef ref)> callback);
+ llvm::function_ref<bool(DWARFDIE die)> callback);
bool Supports_DW_AT_APPLE_objc_complete_type(DWARFUnit *cu);
void SymbolFileDWARFDwo::GetObjCMethods(
lldb_private::ConstString class_name,
- llvm::function_ref<bool(DIERef ref)> callback) {
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
GetBaseSymbolFile().GetObjCMethods(class_name, callback);
}
DWARFCompileUnit *GetDWOCompileUnitForHash(uint64_t hash);
void GetObjCMethods(lldb_private::ConstString class_name,
- llvm::function_ref<bool(DIERef ref)> callback) override;
+ llvm::function_ref<bool(DWARFDIE die)> callback) override;
llvm::Expected<lldb_private::TypeSystem &>
GetTypeSystemForLanguage(lldb::LanguageType language) override;