Path: blob/main/contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
39645 views
//===-- AppleDWARFIndex.h --------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_APPLEDWARFINDEX_H9#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_APPLEDWARFINDEX_H1011#include "Plugins/SymbolFile/DWARF/DWARFIndex.h"12#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"1314namespace lldb_private::plugin {15namespace dwarf {16class AppleDWARFIndex : public DWARFIndex {17public:18static std::unique_ptr<AppleDWARFIndex>19Create(Module &module, DWARFDataExtractor apple_names,20DWARFDataExtractor apple_namespaces, DWARFDataExtractor apple_types,21DWARFDataExtractor apple_objc, DWARFDataExtractor debug_str);2223AppleDWARFIndex(Module &module,24std::unique_ptr<llvm::AppleAcceleratorTable> apple_names,25std::unique_ptr<llvm::AppleAcceleratorTable> apple_namespaces,26std::unique_ptr<llvm::AppleAcceleratorTable> apple_types,27std::unique_ptr<llvm::AppleAcceleratorTable> apple_objc,28lldb::DataBufferSP apple_names_storage,29lldb::DataBufferSP apple_namespaces_storage,30lldb::DataBufferSP apple_types_storage,31lldb::DataBufferSP apple_objc_storage)32: DWARFIndex(module), m_apple_names_up(std::move(apple_names)),33m_apple_namespaces_up(std::move(apple_namespaces)),34m_apple_types_up(std::move(apple_types)),35m_apple_objc_up(std::move(apple_objc)),36m_apple_names_storage(apple_names_storage),37m_apple_namespaces_storage(apple_namespaces_storage),38m_apple_types_storage(apple_types_storage),39m_apple_objc_storage(apple_objc_storage) {}4041void Preload() override {}4243void44GetGlobalVariables(ConstString basename,45llvm::function_ref<bool(DWARFDIE die)> callback) override;46void47GetGlobalVariables(const RegularExpression ®ex,48llvm::function_ref<bool(DWARFDIE die)> callback) override;49void50GetGlobalVariables(DWARFUnit &cu,51llvm::function_ref<bool(DWARFDIE die)> callback) override;52void GetObjCMethods(ConstString class_name,53llvm::function_ref<bool(DWARFDIE die)> callback) override;54void GetCompleteObjCClass(55ConstString class_name, bool must_be_implementation,56llvm::function_ref<bool(DWARFDIE die)> callback) override;57void GetTypes(ConstString name,58llvm::function_ref<bool(DWARFDIE die)> callback) override;59void GetTypes(const DWARFDeclContext &context,60llvm::function_ref<bool(DWARFDIE die)> callback) override;61void GetNamespaces(ConstString name,62llvm::function_ref<bool(DWARFDIE die)> callback) override;63void GetFunctions(const Module::LookupInfo &lookup_info,64SymbolFileDWARF &dwarf,65const CompilerDeclContext &parent_decl_ctx,66llvm::function_ref<bool(DWARFDIE die)> callback) override;67void GetFunctions(const RegularExpression ®ex,68llvm::function_ref<bool(DWARFDIE die)> callback) override;6970void Dump(Stream &s) override;7172private:73std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_names_up;74std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_namespaces_up;75std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_types_up;76std::unique_ptr<llvm::AppleAcceleratorTable> m_apple_objc_up;77/// The following storage variables hold the data that the apple accelerator78/// tables tables above point to.79/// {80lldb::DataBufferSP m_apple_names_storage;81lldb::DataBufferSP m_apple_namespaces_storage;82lldb::DataBufferSP m_apple_types_storage;83lldb::DataBufferSP m_apple_objc_storage;84/// }8586/// Search for entries whose name is `name` in `table`, calling `callback` for87/// each match. If `search_for_tag` is provided, ignore entries whose tag is88/// not `search_for_tag`. If `search_for_qualhash` is provided, ignore entries89/// whose qualified name hash does not match `search_for_qualhash`.90/// If `callback` returns false for an entry, the search is interrupted.91void SearchFor(const llvm::AppleAcceleratorTable &table, llvm::StringRef name,92llvm::function_ref<bool(DWARFDIE die)> callback,93std::optional<dw_tag_t> search_for_tag = std::nullopt,94std::optional<uint32_t> search_for_qualhash = std::nullopt);95};96} // namespace dwarf97} // namespace lldb_private::plugin9899#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_APPLEDWARFINDEX_H100101102