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
14#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
15
16namespace lldb_private::plugin {
17namespace dwarf {
19public:
20 static std::unique_ptr<AppleDWARFIndex>
21 Create(Module &module, DWARFDataExtractor apple_names,
22 DWARFDataExtractor apple_namespaces, DWARFDataExtractor apple_types,
23 DWARFDataExtractor apple_objc, DWARFDataExtractor debug_str);
24
26 std::unique_ptr<llvm::AppleAcceleratorTable> apple_names,
27 std::unique_ptr<llvm::AppleAcceleratorTable> apple_namespaces,
28 std::unique_ptr<llvm::AppleAcceleratorTable> apple_types,
29 std::unique_ptr<llvm::AppleAcceleratorTable> apple_objc,
30 lldb::DataBufferSP apple_names_storage,
31 lldb::DataBufferSP apple_namespaces_storage,
32 lldb::DataBufferSP apple_types_storage,
33 lldb::DataBufferSP apple_objc_storage)
34 : DWARFIndex(module), m_apple_names_up(std::move(apple_names)),
35 m_apple_namespaces_up(std::move(apple_namespaces)),
36 m_apple_types_up(std::move(apple_types)),
37 m_apple_objc_up(std::move(apple_objc)),
38 m_apple_names_storage(apple_names_storage),
39 m_apple_namespaces_storage(apple_namespaces_storage),
40 m_apple_types_storage(apple_types_storage),
41 m_apple_objc_storage(apple_objc_storage) {}
42
43 void Preload() override {}
44
46 ConstString basename,
47 llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
49 const RegularExpression &regex,
50 llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
52 DWARFUnit &cu,
53 llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
54 void GetObjCMethods(
55 ConstString class_name,
56 llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
58 ConstString class_name, bool must_be_implementation,
59 llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
60 void
62 llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
63 void
64 GetTypes(const DWARFDeclContext &context,
65 llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
66 void GetNamespaces(
67 ConstString name,
68 llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
69 void GetFunctions(
70 const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
71 const CompilerDeclContext &parent_decl_ctx,
72 llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
73 void GetFunctions(
74 const RegularExpression &regex,
75 llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
76
77 void Dump(Stream &s) override;
78
79private:
80 std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_names_up;
81 std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_namespaces_up;
82 std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_types_up;
83 std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_objc_up;
84 /// The following storage variables hold the data that the apple accelerator
85 /// tables tables above point to.
86 /// {
91 /// }
92
93 /// Search for entries whose name is `name` in `table`, calling `callback` for
94 /// each match. If `search_for_tag` is provided, ignore entries whose tag is
95 /// not `search_for_tag`. If `search_for_qualhash` is provided, ignore entries
96 /// whose qualified name hash does not match `search_for_qualhash`.
97 /// If `callback` returns `IterationAction::Stop` for an entry, the search is
98 /// interrupted.
99 void SearchFor(const llvm::AppleAcceleratorTable &table, llvm::StringRef name,
100 llvm::function_ref<IterationAction(DWARFDIE die)> callback,
101 std::optional<dw_tag_t> search_for_tag = std::nullopt,
102 std::optional<uint32_t> search_for_qualhash = std::nullopt);
103};
104} // namespace dwarf
105} // namespace lldb_private::plugin
106
107#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:916
A class that describes an executable image and its associated object and symbol files.
Definition Module.h:90
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)
std::unique_ptr< llvm::AppleAcceleratorTable > m_apple_types_up
void SearchFor(const llvm::AppleAcceleratorTable &table, llvm::StringRef name, llvm::function_ref< IterationAction(DWARFDIE die)> callback, std::optional< dw_tag_t > search_for_tag=std::nullopt, std::optional< uint32_t > search_for_qualhash=std::nullopt)
}
static std::unique_ptr< AppleDWARFIndex > Create(Module &module, DWARFDataExtractor apple_names, DWARFDataExtractor apple_namespaces, DWARFDataExtractor apple_types, DWARFDataExtractor apple_objc, DWARFDataExtractor debug_str)
void GetNamespaces(ConstString name, llvm::function_ref< IterationAction(DWARFDIE die)> callback) override
void GetTypes(ConstString name, llvm::function_ref< IterationAction(DWARFDIE die)> callback) override
std::unique_ptr< llvm::AppleAcceleratorTable > m_apple_names_up
void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation, llvm::function_ref< IterationAction(DWARFDIE die)> callback) override
lldb::DataBufferSP m_apple_names_storage
The following storage variables hold the data that the apple accelerator tables tables above point to...
void GetObjCMethods(ConstString class_name, llvm::function_ref< IterationAction(DWARFDIE die)> callback) override
void GetFunctions(const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, llvm::function_ref< IterationAction(DWARFDIE die)> callback) override
std::unique_ptr< llvm::AppleAcceleratorTable > m_apple_namespaces_up
std::unique_ptr< llvm::AppleAcceleratorTable > m_apple_objc_up
void GetGlobalVariables(ConstString basename, llvm::function_ref< IterationAction(DWARFDIE die)> callback) override
Finds global variables with the given base name.
IterationAction
Useful for callbacks whose return type indicates whether to continue iteration or short-circuit.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP