LLDB  mainline
DebugNamesDWARFIndex.h
Go to the documentation of this file.
1 //===-- DebugNamesDWARFIndex.h ---------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DEBUGNAMESDWARFINDEX_H
10 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DEBUGNAMESDWARFINDEX_H
11 
17 #include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
18 
19 namespace lldb_private {
21 public:
22  static llvm::Expected<std::unique_ptr<DebugNamesDWARFIndex>>
23  Create(Module &module, DWARFDataExtractor debug_names,
25 
26  void Preload() override { m_fallback.Preload(); }
27 
28  void
30  llvm::function_ref<bool(DWARFDIE die)> callback) override;
31  void
33  llvm::function_ref<bool(DWARFDIE die)> callback) override;
34  void
35  GetGlobalVariables(const DWARFUnit &cu,
36  llvm::function_ref<bool(DWARFDIE die)> callback) override;
37  void
39  llvm::function_ref<bool(DWARFDIE die)> callback) override {}
41  ConstString class_name, bool must_be_implementation,
42  llvm::function_ref<bool(DWARFDIE die)> callback) override;
43  void GetTypes(ConstString name,
44  llvm::function_ref<bool(DWARFDIE die)> callback) override;
45  void GetTypes(const DWARFDeclContext &context,
46  llvm::function_ref<bool(DWARFDIE die)> callback) override;
47  void GetNamespaces(ConstString name,
48  llvm::function_ref<bool(DWARFDIE die)> callback) override;
50  const CompilerDeclContext &parent_decl_ctx,
51  uint32_t name_type_mask,
52  llvm::function_ref<bool(DWARFDIE die)> callback) override;
53  void GetFunctions(const RegularExpression &regex,
54  llvm::function_ref<bool(DWARFDIE die)> callback) override;
55 
56  void Dump(Stream &s) override;
57 
58 private:
60  std::unique_ptr<llvm::DWARFDebugNames> debug_names_up,
61  DWARFDataExtractor debug_names_data,
62  DWARFDataExtractor debug_str_data,
64  : DWARFIndex(module), m_debug_info(dwarf.DebugInfo()),
65  m_debug_names_data(debug_names_data), m_debug_str_data(debug_str_data),
66  m_debug_names_up(std::move(debug_names_up)),
68 
70 
71  // LLVM DWARFDebugNames will hold a non-owning reference to this data, so keep
72  // track of the ownership here.
75 
76  using DebugNames = llvm::DWARFDebugNames;
77  std::unique_ptr<DebugNames> m_debug_names_up;
79 
80  llvm::Optional<DIERef> ToDIERef(const DebugNames::Entry &entry);
81  bool ProcessEntry(const DebugNames::Entry &entry,
82  llvm::function_ref<bool(DWARFDIE die)> callback,
83  llvm::StringRef name);
84 
86  const DebugNames::NameIndex &ni,
87  llvm::StringRef name);
88 
89  static llvm::DenseSet<dw_offset_t> GetUnits(const DebugNames &debug_names);
90 };
91 
92 } // namespace lldb_private
93 
94 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DEBUGNAMESDWARFINDEX_H
lldb_private::DebugNamesDWARFIndex::Preload
void Preload() override
Definition: DebugNamesDWARFIndex.h:26
lldb_private::DebugNamesDWARFIndex::DebugNames
llvm::DWARFDebugNames DebugNames
Definition: DebugNamesDWARFIndex.h:76
lldb_private::RegularExpression
Definition: RegularExpression.h:18
lldb_private::DebugNamesDWARFIndex::m_debug_names_data
DWARFDataExtractor m_debug_names_data
Definition: DebugNamesDWARFIndex.h:73
lldb_private::DebugNamesDWARFIndex::Dump
void Dump(Stream &s) override
Definition: DebugNamesDWARFIndex.cpp:291
DWARFDebugInfo
Definition: DWARFDebugInfo.h:26
lldb_private::DebugNamesDWARFIndex::m_debug_str_data
DWARFDataExtractor m_debug_str_data
Definition: DebugNamesDWARFIndex.h:74
SymbolFileDWARF
Definition: SymbolFileDWARF.h:58
SymbolFileDWARF.h
lldb_private::Module
Definition: Module.h:75
lldb_private::DebugNamesDWARFIndex
Definition: DebugNamesDWARFIndex.h:20
ManualDWARFIndex.h
lldb_private::Stream
Definition: Stream.h:28
lldb_private::DWARFDataExtractor
Definition: DWARFDataExtractor.h:18
DWARFDIE
Definition: DWARFDIE.h:16
lldb_private::DWARFIndex
Definition: DWARFIndex.h:20
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
DWARFUnit
Definition: DWARFUnit.h:80
lldb_private::DebugNamesDWARFIndex::GetUnits
static llvm::DenseSet< dw_offset_t > GetUnits(const DebugNames &debug_names)
Definition: DebugNamesDWARFIndex.cpp:34
lldb_private::DebugNamesDWARFIndex::m_debug_info
DWARFDebugInfo & m_debug_info
Definition: DebugNamesDWARFIndex.h:69
dwarf
Definition: ABISysV_arc.cpp:61
lldb_private::DebugNamesDWARFIndex::GetObjCMethods
void GetObjCMethods(ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback) override
Definition: DebugNamesDWARFIndex.h:38
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::DebugNamesDWARFIndex::DebugNamesDWARFIndex
DebugNamesDWARFIndex(Module &module, std::unique_ptr< llvm::DWARFDebugNames > debug_names_up, DWARFDataExtractor debug_names_data, DWARFDataExtractor debug_str_data, SymbolFileDWARF &dwarf)
Definition: DebugNamesDWARFIndex.h:59
lldb_private::DebugNamesDWARFIndex::GetNamespaces
void GetNamespaces(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback) override
Definition: DebugNamesDWARFIndex.cpp:225
lldb_private::DebugNamesDWARFIndex::ProcessEntry
bool ProcessEntry(const DebugNames::Entry &entry, llvm::function_ref< bool(DWARFDIE die)> callback, llvm::StringRef name)
Definition: DebugNamesDWARFIndex.cpp:61
LogChannelDWARF.h
lldb_private::CompilerDeclContext
Represents a generic declaration context in a program.
Definition: CompilerDeclContext.h:30
lldb_private::DebugNamesDWARFIndex::m_debug_names_up
std::unique_ptr< DebugNames > m_debug_names_up
Definition: DebugNamesDWARFIndex.h:77
uint32_t
lldb_private::ManualDWARFIndex
Definition: ManualDWARFIndex.h:20
lldb_private::DebugNamesDWARFIndex::GetCompleteObjCClass
void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation, llvm::function_ref< bool(DWARFDIE die)> callback) override
Definition: DebugNamesDWARFIndex.cpp:153
lldb_private::DebugNamesDWARFIndex::ToDIERef
llvm::Optional< DIERef > ToDIERef(const DebugNames::Entry &entry)
Definition: DebugNamesDWARFIndex.cpp:44
lldb_private::ManualDWARFIndex::Preload
void Preload() override
Definition: ManualDWARFIndex.h:27
lldb_private::DebugNamesDWARFIndex::m_fallback
ManualDWARFIndex m_fallback
Definition: DebugNamesDWARFIndex.h:78
DWARFDeclContext
Definition: DWARFDeclContext.h:23
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::DebugNamesDWARFIndex::MaybeLogLookupError
static void MaybeLogLookupError(llvm::Error error, const DebugNames::NameIndex &ni, llvm::StringRef name)
Definition: DebugNamesDWARFIndex.cpp:75
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:29
lldb_private::DebugNamesDWARFIndex::GetGlobalVariables
void GetGlobalVariables(ConstString basename, llvm::function_ref< bool(DWARFDIE die)> callback) override
Finds global variables with the given base name.
Definition: DebugNamesDWARFIndex.cpp:86
lldb_private::DebugNamesDWARFIndex::Create
static llvm::Expected< std::unique_ptr< DebugNamesDWARFIndex > > Create(Module &module, DWARFDataExtractor debug_names, DWARFDataExtractor debug_str, SymbolFileDWARF &dwarf)
Definition: DebugNamesDWARFIndex.cpp:21
ConstString.h
Entry
FormatEntity::Entry Entry
Definition: FormatEntity.cpp:82
lldb_private::DebugNamesDWARFIndex::GetFunctions
void GetFunctions(ConstString name, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, uint32_t name_type_mask, llvm::function_ref< bool(DWARFDIE die)> callback) override
Definition: DebugNamesDWARFIndex.cpp:238
DWARFIndex.h
lldb_private::DebugNamesDWARFIndex::GetTypes
void GetTypes(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback) override
Definition: DebugNamesDWARFIndex.cpp:198