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;
49  void GetFunctions(ConstString name, SymbolFileDWARF &dwarf,
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,
63  SymbolFileDWARF &dwarf)
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)),
67  m_fallback(module, dwarf, GetUnits(*m_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 
85  static void MaybeLogLookupError(llvm::Error error,
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
A class that represents a running process on the host machine.
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
Represents a generic declaration context in a program.
void GetObjCMethods(ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback) override
llvm::Optional< DIERef > ToDIERef(const DebugNames::Entry &entry)
std::unique_ptr< DebugNames > m_debug_names_up
llvm::Error Error
static llvm::DenseSet< dw_offset_t > GetUnits(const DebugNames &debug_names)
void GetGlobalVariables(ConstString basename, llvm::function_ref< bool(DWARFDIE die)> callback) override
Finds global variables with the given base name.
DebugNamesDWARFIndex(Module &module, std::unique_ptr< llvm::DWARFDebugNames > debug_names_up, DWARFDataExtractor debug_names_data, DWARFDataExtractor debug_str_data, SymbolFileDWARF &dwarf)
void GetTypes(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback) override
bool ProcessEntry(const DebugNames::Entry &entry, llvm::function_ref< bool(DWARFDIE die)> callback, llvm::StringRef name)
void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation, llvm::function_ref< bool(DWARFDIE die)> callback) override
void GetNamespaces(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback) override
static void MaybeLogLookupError(llvm::Error error, const DebugNames::NameIndex &ni, llvm::StringRef name)
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:75
A uniqued constant string class.
Definition: ConstString.h:40
void GetFunctions(ConstString name, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, uint32_t name_type_mask, llvm::function_ref< bool(DWARFDIE die)> callback) override
static llvm::Expected< std::unique_ptr< DebugNamesDWARFIndex > > Create(Module &module, DWARFDataExtractor debug_names, DWARFDataExtractor debug_str, SymbolFileDWARF &dwarf)