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#include "lldb/Core/Module.h"
18
20class DWARFDIE;
21
22namespace lldb_private {
24public:
25 DWARFIndex(Module &module) : m_module(module) {}
26 virtual ~DWARFIndex();
27
28 virtual void Preload() = 0;
29
30 /// Finds global variables with the given base name. Any additional filtering
31 /// (e.g., to only retrieve variables from a given context) should be done by
32 /// the consumer.
33 virtual void
35 llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
36
37 virtual void
39 llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
40 /// \a cu must be the skeleton unit if possible, not GetNonSkeletonUnit().
41 virtual void
43 llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
44 virtual void
46 llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
47 virtual void
48 GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
49 llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
50 virtual void GetTypes(ConstString name,
51 llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
52 virtual void GetTypes(const DWARFDeclContext &context,
53 llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
54 virtual void
56 llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
57 virtual void
59 const CompilerDeclContext &parent_decl_ctx,
60 llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
61 virtual void
63 llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
64
65 virtual void Dump(Stream &s) = 0;
66
68
69protected:
72
73 /// Helper function implementing common logic for processing function dies. If
74 /// the function given by "ref" matches search criteria given by
75 /// "parent_decl_ctx" and "name_type_mask", it is inserted into the "dies"
76 /// vector.
77 bool ProcessFunctionDIE(const Module::LookupInfo &lookup_info, DIERef ref,
79 const CompilerDeclContext &parent_decl_ctx,
80 llvm::function_ref<bool(DWARFDIE die)> callback);
81
83 public:
84 DIERefCallbackImpl(const DWARFIndex &index,
85 llvm::function_ref<bool(DWARFDIE die)> callback,
86 llvm::StringRef name);
87 bool operator()(DIERef ref) const;
88
89 private:
92 const llvm::function_ref<bool(DWARFDIE die)> m_callback;
93 const llvm::StringRef m_name;
94 };
96 DIERefCallback(llvm::function_ref<bool(DWARFDIE die)> callback,
97 llvm::StringRef name = {}) const {
98 return DIERefCallbackImpl(*this, callback, name);
99 }
100
101 void ReportInvalidDIERef(DIERef ref, llvm::StringRef name) const;
102};
103} // namespace lldb_private
104
105#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFINDEX_H
Identifies a DWARF debug info entry within a given Module.
Definition: DIERef.h:26
Represents a generic declaration context in a program.
A uniqued constant string class.
Definition: ConstString.h:39
const llvm::function_ref< bool(DWARFDIE die)> m_callback
Definition: DWARFIndex.h:92
virtual void GetGlobalVariables(const RegularExpression &regex, llvm::function_ref< bool(DWARFDIE die)> callback)=0
DWARFIndex(Module &module)
Definition: DWARFIndex.h:25
virtual void GetFunctions(const RegularExpression &regex, llvm::function_ref< bool(DWARFDIE die)> callback)=0
virtual void Dump(Stream &s)=0
StatsDuration::Duration GetIndexTime()
Definition: DWARFIndex.h:67
StatsDuration m_index_time
Definition: DWARFIndex.h:71
virtual void GetGlobalVariables(DWARFUnit &cu, llvm::function_ref< bool(DWARFDIE die)> callback)=0
cu must be the skeleton unit if possible, not GetNonSkeletonUnit().
virtual void GetGlobalVariables(ConstString basename, llvm::function_ref< bool(DWARFDIE die)> callback)=0
Finds global variables with the given base name.
virtual void GetTypes(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback)=0
virtual void GetNamespaces(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback)=0
virtual void GetObjCMethods(ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback)=0
bool ProcessFunctionDIE(const Module::LookupInfo &lookup_info, DIERef ref, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, llvm::function_ref< bool(DWARFDIE die)> callback)
Helper function implementing common logic for processing function dies.
Definition: DWARFIndex.cpp:23
virtual void Preload()=0
virtual void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation, llvm::function_ref< bool(DWARFDIE die)> callback)=0
void ReportInvalidDIERef(DIERef ref, llvm::StringRef name) const
Definition: DWARFIndex.cpp:102
virtual void GetTypes(const DWARFDeclContext &context, llvm::function_ref< bool(DWARFDIE die)> callback)=0
DIERefCallbackImpl DIERefCallback(llvm::function_ref< bool(DWARFDIE die)> callback, llvm::StringRef name={}) const
Definition: DWARFIndex.h:96
virtual void GetFunctions(const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, llvm::function_ref< bool(DWARFDIE die)> callback)=0
A class that encapsulates name lookup information.
Definition: Module.h:950
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:88
std::chrono::duration< double > Duration
Definition: Statistics.h:31
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
A class that represents a running process on the host machine.