LLDB  mainline
ManualDWARFIndex.h
Go to the documentation of this file.
1 //===-- ManulaDWARFIndex.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_MANUALDWARFINDEX_H
10 #define LLDB_MANUALDWARFINDEX_H
11 
14 #include "llvm/ADT/DenseSet.h"
15 
16 namespace lldb_private {
17 class ManualDWARFIndex : public DWARFIndex {
18 public:
19  ManualDWARFIndex(Module &module, DWARFDebugInfo *debug_info,
20  llvm::DenseSet<dw_offset_t> units_to_avoid = {})
21  : DWARFIndex(module), m_debug_info(debug_info),
22  m_units_to_avoid(std::move(units_to_avoid)) {}
23 
24  void Preload() override { Index(); }
25 
26  void GetGlobalVariables(ConstString basename, DIEArray &offsets) override;
27  void GetGlobalVariables(const RegularExpression &regex,
28  DIEArray &offsets) override;
29  void GetGlobalVariables(const DWARFUnit &cu, DIEArray &offsets) override;
30  void GetObjCMethods(ConstString class_name, DIEArray &offsets) override;
31  void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
32  DIEArray &offsets) override;
33  void GetTypes(ConstString name, DIEArray &offsets) override;
34  void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override;
35  void GetNamespaces(ConstString name, DIEArray &offsets) override;
36  void GetFunctions(ConstString name, DWARFDebugInfo &info,
37  const CompilerDeclContext &parent_decl_ctx,
38  uint32_t name_type_mask,
39  std::vector<DWARFDIE> &dies) override;
40  void GetFunctions(const RegularExpression &regex, DIEArray &offsets) override;
41 
43  llvm::StringRef name) override {}
44  void Dump(Stream &s) override;
45 
46 private:
47  struct IndexSet {
48  NameToDIE function_basenames;
49  NameToDIE function_fullnames;
50  NameToDIE function_methods;
51  NameToDIE function_selectors;
52  NameToDIE objc_class_selectors;
53  NameToDIE globals;
54  NameToDIE types;
55  NameToDIE namespaces;
56  };
57  void Index();
58  void IndexUnit(DWARFUnit &unit, IndexSet &set);
59 
60  static void
61  IndexUnitImpl(DWARFUnit &unit, const lldb::LanguageType cu_language,
62  const DWARFFormValue::FixedFormSizes &fixed_form_sizes,
63  const dw_offset_t cu_offset, IndexSet &set);
64 
65  /// Non-null value means we haven't built the index yet.
66  DWARFDebugInfo *m_debug_info;
67  /// Which dwarf units should we skip while building the index.
68  llvm::DenseSet<dw_offset_t> m_units_to_avoid;
69 
70  IndexSet m_set;
71 };
72 } // namespace lldb_private
73 
74 #endif // LLDB_MANUALDWARFINDEX_H
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
ManualDWARFIndex(Module &module, DWARFDebugInfo *debug_info, llvm::DenseSet< dw_offset_t > units_to_avoid={})
void GetFunctions(ConstString name, DWARFDebugInfo &info, const CompilerDeclContext &parent_decl_ctx, uint32_t name_type_mask, std::vector< DWARFDIE > &dies) override
"lldb/Utility/RegularExpression.h" A C++ wrapper class for regex.
std::vector< DIERef > DIEArray
Definition: DIERef.h:51
void GetTypes(ConstString name, DIEArray &offsets) override
void GetObjCMethods(ConstString class_name, DIEArray &offsets) override
void ReportInvalidDIEOffset(dw_offset_t offset, llvm::StringRef name) override
LanguageType
Programming language type.
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:109
void GetNamespaces(ConstString name, DIEArray &offsets) override
A uniqued constant string class.
Definition: ConstString.h:38
char * basename(char *path)
void Dump(Stream &s) override
void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation, DIEArray &offsets) override
void GetGlobalVariables(ConstString basename, DIEArray &offsets) override
Finds global variables with the given base name.
DWARFIndex(Module &module)
Definition: DWARFIndex.h:23