brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · 6da0cce Raw
108 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_APPLEDWARFINDEX_H10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_APPLEDWARFINDEX_H11 12#include "Plugins/SymbolFile/DWARF/DWARFIndex.h"13#include "lldb/lldb-private-enumerations.h"14#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"15 16namespace lldb_private::plugin {17namespace dwarf {18class AppleDWARFIndex : public DWARFIndex {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 25  AppleDWARFIndex(Module &module,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 45  void GetGlobalVariables(46      ConstString basename,47      llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;48  void GetGlobalVariables(49      const RegularExpression &regex,50      llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;51  void GetGlobalVariables(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;57  void GetCompleteObjCClass(58      ConstString class_name, bool must_be_implementation,59      llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;60  void61  GetTypes(ConstString name,62           llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;63  void64  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 accelerator85  /// tables tables above point to.86  /// {87  lldb::DataBufferSP m_apple_names_storage;88  lldb::DataBufferSP m_apple_namespaces_storage;89  lldb::DataBufferSP m_apple_types_storage;90  lldb::DataBufferSP m_apple_objc_storage;91  /// }92 93  /// Search for entries whose name is `name` in `table`, calling `callback` for94  /// each match. If `search_for_tag` is provided, ignore entries whose tag is95  /// not `search_for_tag`. If `search_for_qualhash` is provided, ignore entries96  /// whose qualified name hash does not match `search_for_qualhash`.97  /// If `callback` returns `IterationAction::Stop` for an entry, the search is98  /// 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 dwarf105} // namespace lldb_private::plugin106 107#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_APPLEDWARFINDEX_H108