]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
MFC r355940:
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / source / Plugins / SymbolFile / DWARF / DWARFIndex.h
1 //===-- DWARFIndex.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_DWARFINDEX_H
10 #define LLDB_DWARFINDEX_H
11
12 #include "Plugins/SymbolFile/DWARF/DIERef.h"
13 #include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
14 #include "Plugins/SymbolFile/DWARF/DWARFFormValue.h"
15
16 class DWARFDeclContext;
17 class DWARFDIE;
18
19 namespace lldb_private {
20 class DWARFIndex {
21 public:
22   DWARFIndex(Module &module) : m_module(module) {}
23   virtual ~DWARFIndex();
24
25   virtual void Preload() = 0;
26
27   /// Finds global variables with the given base name. Any additional filtering
28   /// (e.g., to only retrieve variables from a given context) should be done by
29   /// the consumer.
30   virtual void GetGlobalVariables(ConstString basename, DIEArray &offsets) = 0;
31
32   virtual void GetGlobalVariables(const RegularExpression &regex,
33                                   DIEArray &offsets) = 0;
34   virtual void GetGlobalVariables(const DWARFUnit &cu, DIEArray &offsets) = 0;
35   virtual void GetObjCMethods(ConstString class_name, DIEArray &offsets) = 0;
36   virtual void GetCompleteObjCClass(ConstString class_name,
37                                     bool must_be_implementation,
38                                     DIEArray &offsets) = 0;
39   virtual void GetTypes(ConstString name, DIEArray &offsets) = 0;
40   virtual void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) = 0;
41   virtual void GetNamespaces(ConstString name, DIEArray &offsets) = 0;
42   virtual void GetFunctions(ConstString name, SymbolFileDWARF &dwarf,
43                             const CompilerDeclContext &parent_decl_ctx,
44                             uint32_t name_type_mask,
45                             std::vector<DWARFDIE> &dies) = 0;
46   virtual void GetFunctions(const RegularExpression &regex,
47                             DIEArray &offsets) = 0;
48
49   virtual void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) = 0;
50   virtual void Dump(Stream &s) = 0;
51
52 protected:
53   Module &m_module;
54
55   /// Helper function implementing common logic for processing function dies. If
56   /// the function given by "ref" matches search criteria given by
57   /// "parent_decl_ctx" and "name_type_mask", it is inserted into the "dies"
58   /// vector.
59   void ProcessFunctionDIE(llvm::StringRef name, DIERef ref,
60                           SymbolFileDWARF &dwarf,
61                           const CompilerDeclContext &parent_decl_ctx,
62                           uint32_t name_type_mask, std::vector<DWARFDIE> &dies);
63 };
64 } // namespace lldb_private
65
66 #endif // LLDB_DWARFINDEX_H