diff options
| author | Pavel Labath <labath@google.com> | 2018-06-08 09:10:31 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2018-06-08 09:10:31 +0000 |
| commit | 257ff33989927912435de65d7434f055e7896f7a (patch) | |
| tree | c9a4afe47aae468e32572130e6f4099b91672321 /lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp | |
| parent | 6dedf2b5d8c01eb17e180a75ac6350b3d3f04dd2 (diff) | |
| download | bcm5719-llvm-257ff33989927912435de65d7434f055e7896f7a.tar.gz bcm5719-llvm-257ff33989927912435de65d7434f055e7896f7a.zip | |
DebugNamesDWARFIndex: Implement GetFunctions method
Summary:
This patch implements the non-regex variant of GetFunctions. To share
more code with the Apple implementation, I've extracted the common
filtering code from that class into a utility function on the DWARFIndex
base class.
The new implementation also searching the accelerator table multiple
times -- previously it could happen that the apple table would return
the same die more than once if one specified multiple search flags in
name_type_mask. This way, I separate table iteration from filtering, and
so we can be sure each die is inserted at most once.
Reviewers: clayborg, JDevlieghere
Subscribers: aprantl, lldb-commits
Differential Revision: https://reviews.llvm.org/D47881
llvm-svn: 334273
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp index 5d434e06170..a7494737cab 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h" +#include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Stream.h" @@ -44,12 +45,18 @@ DebugNamesDWARFIndex::GetUnits(const DebugNames &debug_names) { return result; } -void DebugNamesDWARFIndex::Append(const DebugNames::Entry &entry, - DIEArray &offsets) { +DIERef DebugNamesDWARFIndex::ToDIERef(const DebugNames::Entry &entry) { llvm::Optional<uint64_t> cu_offset = entry.getCUOffset(); llvm::Optional<uint64_t> die_offset = entry.getDIESectionOffset(); if (cu_offset && die_offset) - offsets.emplace_back(*cu_offset, *die_offset); + return DIERef(*cu_offset, *die_offset); + return DIERef(); +} + +void DebugNamesDWARFIndex::Append(const DebugNames::Entry &entry, + DIEArray &offsets) { + if (DIERef ref = ToDIERef(entry)) + offsets.push_back(ref); } void DebugNamesDWARFIndex::MaybeLogLookupError(llvm::Error error, @@ -118,6 +125,25 @@ void DebugNamesDWARFIndex::GetNamespaces(ConstString name, DIEArray &offsets) { } } +void DebugNamesDWARFIndex::GetFunctions( + ConstString name, DWARFDebugInfo &info, + const CompilerDeclContext &parent_decl_ctx, uint32_t name_type_mask, + std::vector<DWARFDIE> &dies) { + + m_fallback.GetFunctions(name, info, parent_decl_ctx, name_type_mask, dies); + + for (const DebugNames::Entry &entry : + m_debug_names_up->equal_range(name.GetStringRef())) { + Tag tag = entry.tag(); + if (tag != DW_TAG_subprogram && tag != DW_TAG_inlined_subroutine) + continue; + + if (DIERef ref = ToDIERef(entry)) + ProcessFunctionDIE(name.GetStringRef(), ref, info, parent_decl_ctx, + name_type_mask, dies); + } +} + void DebugNamesDWARFIndex::Dump(Stream &s) { m_fallback.Dump(s); |

