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_DEBUGNAMESDWARFINDEX_H
10 #define LLDB_DEBUGNAMESDWARFINDEX_H
11 
16 #include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
17 
18 namespace lldb_private {
20 public:
21  static llvm::Expected<std::unique_ptr<DebugNamesDWARFIndex>>
22  Create(Module &module, DWARFDataExtractor debug_names,
23  DWARFDataExtractor debug_str, DWARFDebugInfo *debug_info);
24 
25  void Preload() override { m_fallback.Preload(); }
26 
27  void GetGlobalVariables(ConstString basename, DIEArray &offsets) override;
28  void GetGlobalVariables(const RegularExpression &regex,
29  DIEArray &offsets) override;
30  void GetGlobalVariables(const DWARFUnit &cu, DIEArray &offsets) override;
31  void GetObjCMethods(ConstString class_name, DIEArray &offsets) override {}
32  void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
33  DIEArray &offsets) override;
34  void GetTypes(ConstString name, DIEArray &offsets) override;
35  void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override;
36  void GetNamespaces(ConstString name, DIEArray &offsets) override;
37  void GetFunctions(ConstString name, DWARFDebugInfo &info,
38  const CompilerDeclContext &parent_decl_ctx,
39  uint32_t name_type_mask,
40  std::vector<DWARFDIE> &dies) override;
41  void GetFunctions(const RegularExpression &regex,
42  DIEArray &offsets) override;
43 
45  llvm::StringRef name) override {}
46  void Dump(Stream &s) override;
47 
48 private:
50  std::unique_ptr<llvm::DWARFDebugNames> debug_names_up,
51  DWARFDataExtractor debug_names_data,
52  DWARFDataExtractor debug_str_data,
53  DWARFDebugInfo &debug_info)
54  : DWARFIndex(module), m_debug_info(debug_info),
55  m_debug_names_data(debug_names_data), m_debug_str_data(debug_str_data),
56  m_debug_names_up(std::move(debug_names_up)),
57  m_fallback(module, &debug_info, GetUnits(*m_debug_names_up)) {}
58 
59  DWARFDebugInfo &m_debug_info;
60 
61  // LLVM DWARFDebugNames will hold a non-owning reference to this data, so keep
62  // track of the ownership here.
63  DWARFDataExtractor m_debug_names_data;
64  DWARFDataExtractor m_debug_str_data;
65 
66  using DebugNames = llvm::DWARFDebugNames;
67  std::unique_ptr<DebugNames> m_debug_names_up;
68  ManualDWARFIndex m_fallback;
69 
70  DIERef ToDIERef(const DebugNames::Entry &entry);
71  void Append(const DebugNames::Entry &entry, DIEArray &offsets);
72 
73  static void MaybeLogLookupError(llvm::Error error,
74  const DebugNames::NameIndex &ni,
75  llvm::StringRef name);
76 
77  static llvm::DenseSet<dw_offset_t> GetUnits(const DebugNames &debug_names);
78 };
79 
80 } // namespace lldb_private
81 
82 #endif // LLDB_DEBUGNAMESDWARFINDEX_H
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
void GetNamespaces(ConstString name, DIEArray &offsets) override
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
static llvm::Expected< std::unique_ptr< DebugNamesDWARFIndex > > Create(Module &module, DWARFDataExtractor debug_names, DWARFDataExtractor debug_str, DWARFDebugInfo *debug_info)
llvm::Error Error
void GetGlobalVariables(ConstString basename, DIEArray &offsets) override
Finds global variables with the given base name.
"lldb/Utility/RegularExpression.h" A C++ wrapper class for regex.
Definition: DIERef.h:18
void ReportInvalidDIEOffset(dw_offset_t offset, llvm::StringRef name) override
std::vector< DIERef > DIEArray
Definition: DIERef.h:51
void GetTypes(ConstString name, DIEArray &offsets) override
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:109
void GetObjCMethods(ConstString class_name, DIEArray &offsets) override
void GetFunctions(ConstString name, DWARFDebugInfo &info, const CompilerDeclContext &parent_decl_ctx, uint32_t name_type_mask, std::vector< DWARFDIE > &dies) override
A uniqued constant string class.
Definition: ConstString.h:38
void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation, DIEArray &offsets) override
char * basename(char *path)
DWARFIndex(Module &module)
Definition: DWARFIndex.h:23