LLDB  mainline
DWARFIndex.h
Go to the documentation of this file.
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_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFINDEX_H
10 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFINDEX_H
11 
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
32  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
33 
34  virtual void
36  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
37  virtual void
38  GetGlobalVariables(const DWARFUnit &cu,
39  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
40  virtual void
41  GetObjCMethods(ConstString class_name,
42  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
43  virtual void
44  GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
45  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
46  virtual void GetTypes(ConstString name,
47  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
48  virtual void GetTypes(const DWARFDeclContext &context,
49  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
50  virtual void
52  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
53  virtual void
55  const CompilerDeclContext &parent_decl_ctx,
56  uint32_t name_type_mask,
57  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
58  virtual void
59  GetFunctions(const RegularExpression &regex,
60  llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
61 
62  virtual void Dump(Stream &s) = 0;
63 
64 protected:
66 
67  /// Helper function implementing common logic for processing function dies. If
68  /// the function given by "ref" matches search criteria given by
69  /// "parent_decl_ctx" and "name_type_mask", it is inserted into the "dies"
70  /// vector.
71  bool ProcessFunctionDIE(llvm::StringRef name, DIERef ref,
73  const CompilerDeclContext &parent_decl_ctx,
74  uint32_t name_type_mask,
75  llvm::function_ref<bool(DWARFDIE die)> callback);
76 
78  public:
79  DIERefCallbackImpl(const DWARFIndex &index,
80  llvm::function_ref<bool(DWARFDIE die)> callback,
81  llvm::StringRef name);
82  bool operator()(DIERef ref) const;
83 
84  private:
87  const llvm::function_ref<bool(DWARFDIE die)> m_callback;
88  const llvm::StringRef m_name;
89  };
91  DIERefCallback(llvm::function_ref<bool(DWARFDIE die)> callback,
92  llvm::StringRef name = {}) const {
93  return DIERefCallbackImpl(*this, callback, name);
94  }
95 
96  void ReportInvalidDIERef(DIERef ref, llvm::StringRef name) const;
97 };
98 } // namespace lldb_private
99 
100 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFINDEX_H
DWARFFormValue.h
DIERef
Identifies a DWARF debug info entry within a given Module.
Definition: DIERef.h:26
DIERef.h
lldb_private::RegularExpression
Definition: RegularExpression.h:18
DWARFDIE.h
lldb_private::DWARFIndex::DIERefCallback
DIERefCallbackImpl DIERefCallback(llvm::function_ref< bool(DWARFDIE die)> callback, llvm::StringRef name={}) const
Definition: DWARFIndex.h:91
lldb_private::DWARFIndex::DWARFIndex
DWARFIndex(Module &module)
Definition: DWARFIndex.h:22
lldb_private::DWARFIndex::GetTypes
virtual void GetTypes(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback)=0
lldb_private::DWARFIndex::GetCompleteObjCClass
virtual void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation, llvm::function_ref< bool(DWARFDIE die)> callback)=0
SymbolFileDWARF
Definition: SymbolFileDWARF.h:58
lldb_private::DWARFIndex::DIERefCallbackImpl::DIERefCallbackImpl
DIERefCallbackImpl(const DWARFIndex &index, llvm::function_ref< bool(DWARFDIE die)> callback, llvm::StringRef name)
Definition: DWARFIndex.cpp:67
lldb_private::Module
Definition: Module.h:75
lldb_private::Stream
Definition: Stream.h:28
lldb_private::DWARFIndex::GetGlobalVariables
virtual void GetGlobalVariables(ConstString basename, llvm::function_ref< bool(DWARFDIE die)> callback)=0
Finds global variables with the given base name.
DWARFDIE
Definition: DWARFDIE.h:16
lldb_private::DWARFIndex
Definition: DWARFIndex.h:20
lldb_private::DWARFIndex::Preload
virtual void Preload()=0
DWARFUnit
Definition: DWARFUnit.h:80
dwarf
Definition: ABISysV_arc.cpp:61
lldb_private::DWARFIndex::DIERefCallbackImpl::m_index
const DWARFIndex & m_index
Definition: DWARFIndex.h:85
lldb_private::DWARFIndex::DIERefCallbackImpl::m_dwarf
SymbolFileDWARF & m_dwarf
Definition: DWARFIndex.h:86
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::DWARFIndex::~DWARFIndex
virtual ~DWARFIndex()
lldb_private::DWARFIndex::DIERefCallbackImpl::operator()
bool operator()(DIERef ref) const
Definition: DWARFIndex.cpp:74
lldb_private::DWARFIndex::ReportInvalidDIERef
void ReportInvalidDIERef(DIERef ref, llvm::StringRef name) const
Definition: DWARFIndex.cpp:81
lldb_private::DWARFIndex::ProcessFunctionDIE
bool ProcessFunctionDIE(llvm::StringRef name, DIERef ref, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, uint32_t name_type_mask, llvm::function_ref< bool(DWARFDIE die)> callback)
Helper function implementing common logic for processing function dies.
Definition: DWARFIndex.cpp:21
lldb_private::DWARFIndex::DIERefCallbackImpl
Definition: DWARFIndex.h:77
lldb_private::CompilerDeclContext
Represents a generic declaration context in a program.
Definition: CompilerDeclContext.h:30
lldb_private::DWARFIndex::DIERefCallbackImpl::m_name
const llvm::StringRef m_name
Definition: DWARFIndex.h:88
uint32_t
lldb_private::DWARFIndex::GetFunctions
virtual void GetFunctions(ConstString name, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, uint32_t name_type_mask, llvm::function_ref< bool(DWARFDIE die)> callback)=0
lldb_private::DWARFIndex::m_module
Module & m_module
Definition: DWARFIndex.h:65
lldb_private::DWARFIndex::Dump
virtual void Dump(Stream &s)=0
lldb_private::DWARFIndex::GetObjCMethods
virtual void GetObjCMethods(ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback)=0
DWARFDeclContext
Definition: DWARFDeclContext.h:23
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::DWARFIndex::GetNamespaces
virtual void GetNamespaces(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback)=0
lldb_private::DWARFIndex::DIERefCallbackImpl::m_callback
const llvm::function_ref< bool(DWARFDIE die)> m_callback
Definition: DWARFIndex.h:87