summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-06-08 10:31:55 +0000
committerPavel Labath <labath@google.com>2018-06-08 10:31:55 +0000
commita3ee1e7f9208e1ae40eb23e030de9570f6523e3b (patch)
tree6f5f12c69250fd17b660d505668a4a97f466ef0f /lldb/source/Plugins/SymbolFile
parentad45efc445e9dcabf0fc3d42dba89910630da4e3 (diff)
downloadbcm5719-llvm-a3ee1e7f9208e1ae40eb23e030de9570f6523e3b.tar.gz
bcm5719-llvm-a3ee1e7f9208e1ae40eb23e030de9570f6523e3b.zip
DebugNamesDWARFIndex: Implement regex version of the GetFunctions method
This also fixes a bug where SymbolFileDWARF was returning the same function multiple times - this can happen if both mangled and demangled names match the regex. Other lookup lookup functions had code to handle this case, but it was forgotten here. llvm-svn: 334277
Diffstat (limited to 'lldb/source/Plugins/SymbolFile')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp23
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp19
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h3
4 files changed, 34 insertions, 13 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index a7494737cab..aa123e069fd 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -144,6 +144,29 @@ void DebugNamesDWARFIndex::GetFunctions(
}
}
+void DebugNamesDWARFIndex::GetFunctions(const RegularExpression &regex,
+ DIEArray &offsets) {
+ m_fallback.GetFunctions(regex, offsets);
+
+ for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
+ for (DebugNames::NameTableEntry nte: ni) {
+ if (!regex.Execute(nte.getString()))
+ continue;
+
+ uint32_t entry_offset = nte.getEntryOffset();
+ llvm::Expected<DebugNames::Entry> entry_or = ni.getEntry(&entry_offset);
+ for (; entry_or; entry_or = ni.getEntry(&entry_offset)) {
+ Tag tag = entry_or->tag();
+ if (tag != DW_TAG_subprogram && tag != DW_TAG_inlined_subroutine)
+ continue;
+
+ Append(*entry_or, offsets);
+ }
+ MaybeLogLookupError(entry_or.takeError(), ni, nte.getString());
+ }
+ }
+}
+
void DebugNamesDWARFIndex::Dump(Stream &s) {
m_fallback.Dump(s);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
index ab3434e017e..28f75d068b0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -40,7 +40,7 @@ public:
uint32_t name_type_mask,
std::vector<DWARFDIE> &dies) override;
void GetFunctions(const RegularExpression &regex,
- DIEArray &offsets) override {}
+ DIEArray &offsets) override;
void ReportInvalidDIEOffset(dw_offset_t offset,
llvm::StringRef name) override {}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 08d595a9aa7..b7dd461c564 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2155,13 +2155,6 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(const RegularExpression &regex,
return variables.GetSize() - original_size;
}
-bool SymbolFileDWARF::ResolveFunction(const DIERef &die_ref,
- bool include_inlines,
- SymbolContextList &sc_list) {
- DWARFDIE die = DebugInfo()->GetDIE(die_ref);
- return ResolveFunction(die, include_inlines, sc_list);
-}
-
bool SymbolFileDWARF::ResolveFunction(const DWARFDIE &orig_die,
bool include_inlines,
SymbolContextList &sc_list) {
@@ -2335,8 +2328,16 @@ uint32_t SymbolFileDWARF::FindFunctions(const RegularExpression &regex,
DIEArray offsets;
m_index->GetFunctions(regex, offsets);
- for (DIERef ref : offsets)
- ResolveFunction(ref, include_inlines, sc_list);
+ llvm::DenseSet<const DWARFDebugInfoEntry *> resolved_dies;
+ for (DIERef ref : offsets) {
+ DWARFDIE die = info->GetDIE(ref);
+ if (!die) {
+ m_index->ReportInvalidDIEOffset(ref.die_offset, regex.GetText());
+ continue;
+ }
+ if (resolved_dies.insert(die.GetDIE()).second)
+ ResolveFunction(die, include_inlines, sc_list);
+ }
// Return the number of variable that were appended to the list
return sc_list.GetSize() - original_size;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 2872942e2ce..a5f2ac8f3e7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -385,9 +385,6 @@ protected:
bool ClassOrStructIsVirtual(const DWARFDIE &die);
// Given a die_offset, figure out the symbol context representing that die.
- bool ResolveFunction(const DIERef &die_ref, bool include_inlines,
- lldb_private::SymbolContextList &sc_list);
-
bool ResolveFunction(const DWARFDIE &die, bool include_inlines,
lldb_private::SymbolContextList &sc_list);
OpenPOWER on IntegriCloud