LLDB mainline
AppleDWARFIndex.h
Go to the documentation of this file.
1//===-- AppleDWARFIndex.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_APPLEDWARFINDEX_H
10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_APPLEDWARFINDEX_H
11
13#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
14
15namespace lldb_private::plugin {
16namespace dwarf {
18public:
19 static std::unique_ptr<AppleDWARFIndex>
20 Create(Module &module, DWARFDataExtractor apple_names,
21 DWARFDataExtractor apple_namespaces, DWARFDataExtractor apple_types,
22 DWARFDataExtractor apple_objc, DWARFDataExtractor debug_str);
23
25 std::unique_ptr<llvm::AppleAcceleratorTable> apple_names,
26 std::unique_ptr<llvm::AppleAcceleratorTable> apple_namespaces,
27 std::unique_ptr<llvm::AppleAcceleratorTable> apple_types,
28 std::unique_ptr<llvm::AppleAcceleratorTable> apple_objc,
29 lldb::DataBufferSP apple_names_storage,
30 lldb::DataBufferSP apple_namespaces_storage,
31 lldb::DataBufferSP apple_types_storage,
32 lldb::DataBufferSP apple_objc_storage)
33 : DWARFIndex(module), m_apple_names_up(std::move(apple_names)),
34 m_apple_namespaces_up(std::move(apple_namespaces)),
35 m_apple_types_up(std::move(apple_types)),
36 m_apple_objc_up(std::move(apple_objc)),
37 m_apple_names_storage(apple_names_storage),
38 m_apple_namespaces_storage(apple_namespaces_storage),
39 m_apple_types_storage(apple_types_storage),
40 m_apple_objc_storage(apple_objc_storage) {}
41
42 void Preload() override {}
43
44 void
46 llvm::function_ref<bool(DWARFDIE die)> callback) override;
47 void
49 llvm::function_ref<bool(DWARFDIE die)> callback) override;
50 void
52 llvm::function_ref<bool(DWARFDIE die)> callback) override;
53 void GetObjCMethods(ConstString class_name,
54 llvm::function_ref<bool(DWARFDIE die)> callback) override;
56 ConstString class_name, bool must_be_implementation,
57 llvm::function_ref<bool(DWARFDIE die)> callback) override;
58 void GetTypes(ConstString name,
59 llvm::function_ref<bool(DWARFDIE die)> callback) override;
60 void GetTypes(const DWARFDeclContext &context,
61 llvm::function_ref<bool(DWARFDIE die)> callback) override;
62 void GetNamespaces(ConstString name,
63 llvm::function_ref<bool(DWARFDIE die)> callback) override;
64 void GetFunctions(const Module::LookupInfo &lookup_info,
66 const CompilerDeclContext &parent_decl_ctx,
67 llvm::function_ref<bool(DWARFDIE die)> callback) override;
68 void GetFunctions(const RegularExpression &regex,
69 llvm::function_ref<bool(DWARFDIE die)> callback) override;
70
71 void Dump(Stream &s) override;
72
73private:
74 std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_names_up;
75 std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_namespaces_up;
76 std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_types_up;
77 std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_objc_up;
78 /// The following storage variables hold the data that the apple accelerator
79 /// tables tables above point to.
80 /// {
85 /// }
86
87 /// Search for entries whose name is `name` in `table`, calling `callback` for
88 /// each match. If `search_for_tag` is provided, ignore entries whose tag is
89 /// not `search_for_tag`. If `search_for_qualhash` is provided, ignore entries
90 /// whose qualified name hash does not match `search_for_qualhash`.
91 /// If `callback` returns false for an entry, the search is interrupted.
92 void SearchFor(const llvm::AppleAcceleratorTable &table, llvm::StringRef name,
93 llvm::function_ref<bool(DWARFDIE die)> callback,
94 std::optional<dw_tag_t> search_for_tag = std::nullopt,
95 std::optional<uint32_t> search_for_qualhash = std::nullopt);
96};
97} // namespace dwarf
98} // namespace lldb_private::plugin
99
100#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_APPLEDWARFINDEX_H
Represents a generic declaration context in a program.
A uniqued constant string class.
Definition: ConstString.h:40
A class that encapsulates name lookup information.
Definition: Module.h:904
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:88
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
AppleDWARFIndex(Module &module, std::unique_ptr< llvm::AppleAcceleratorTable > apple_names, std::unique_ptr< llvm::AppleAcceleratorTable > apple_namespaces, std::unique_ptr< llvm::AppleAcceleratorTable > apple_types, std::unique_ptr< llvm::AppleAcceleratorTable > apple_objc, lldb::DataBufferSP apple_names_storage, lldb::DataBufferSP apple_namespaces_storage, lldb::DataBufferSP apple_types_storage, lldb::DataBufferSP apple_objc_storage)
void GetGlobalVariables(ConstString basename, llvm::function_ref< bool(DWARFDIE die)> callback) override
Finds global variables with the given base name.
std::unique_ptr< llvm::AppleAcceleratorTable > m_apple_types_up
void GetNamespaces(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback) override
void GetObjCMethods(ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback) override
static std::unique_ptr< AppleDWARFIndex > Create(Module &module, DWARFDataExtractor apple_names, DWARFDataExtractor apple_namespaces, DWARFDataExtractor apple_types, DWARFDataExtractor apple_objc, DWARFDataExtractor debug_str)
void GetTypes(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback) override
std::unique_ptr< llvm::AppleAcceleratorTable > m_apple_names_up
void SearchFor(const llvm::AppleAcceleratorTable &table, llvm::StringRef name, llvm::function_ref< bool(DWARFDIE die)> callback, std::optional< dw_tag_t > search_for_tag=std::nullopt, std::optional< uint32_t > search_for_qualhash=std::nullopt)
}
lldb::DataBufferSP m_apple_names_storage
The following storage variables hold the data that the apple accelerator tables tables above point to...
std::unique_ptr< llvm::AppleAcceleratorTable > m_apple_namespaces_up
std::unique_ptr< llvm::AppleAcceleratorTable > m_apple_objc_up
void GetFunctions(const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, llvm::function_ref< bool(DWARFDIE die)> callback) override
void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation, llvm::function_ref< bool(DWARFDIE die)> callback) override
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:332