1 //===-- SymbolFileDWARFDwo.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_SYMBOLFILEDWARFDWO_H 10 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARFDWO_H 11 12 #include "SymbolFileDWARF.h" 13 #include <optional> 14 15 namespace lldb_private::plugin { 16 namespace dwarf { 17 class SymbolFileDWARFDwo : public SymbolFileDWARF { 18 /// LLVM RTTI support. 19 static char ID; 20 21 public: 22 /// LLVM RTTI support. 23 /// \{ isA(const void * ClassID)24 bool isA(const void *ClassID) const override { 25 return ClassID == &ID || SymbolFileDWARF::isA(ClassID); 26 } classof(const SymbolFile * obj)27 static bool classof(const SymbolFile *obj) { return obj->isA(&ID); } 28 /// \} 29 30 SymbolFileDWARFDwo(SymbolFileDWARF &m_base_symbol_file, 31 lldb::ObjectFileSP objfile, uint32_t id); 32 33 ~SymbolFileDWARFDwo() override = default; 34 35 DWARFCompileUnit *GetDWOCompileUnitForHash(uint64_t hash); 36 37 void GetObjCMethods(ConstString class_name, 38 llvm::function_ref<bool(DWARFDIE die)> callback) override; 39 40 llvm::Expected<lldb::TypeSystemSP> 41 GetTypeSystemForLanguage(lldb::LanguageType language) override; 42 43 DWARFDIE 44 GetDIE(const DIERef &die_ref) override; 45 46 lldb::offset_t GetVendorDWARFOpcodeSize(const DataExtractor &data, 47 const lldb::offset_t data_offset, 48 const uint8_t op) const override; 49 50 uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override; 51 52 bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes, 53 lldb::offset_t &offset, 54 std::vector<Value> &stack) const override; 55 56 void FindGlobalVariables(ConstString name, 57 const CompilerDeclContext &parent_decl_ctx, 58 uint32_t max_matches, 59 VariableList &variables) override; 60 GetBaseSymbolFile()61 SymbolFileDWARF &GetBaseSymbolFile() const { return m_base_symbol_file; } 62 63 bool GetDebugInfoIndexWasLoadedFromCache() const override; 64 void SetDebugInfoIndexWasLoadedFromCache() override; 65 bool GetDebugInfoIndexWasSavedToCache() const override; 66 void SetDebugInfoIndexWasSavedToCache() override; 67 bool GetDebugInfoHadFrameVariableErrors() const override; 68 void SetDebugInfoHadFrameVariableErrors() override; 69 70 SymbolFileDWARF *GetDIERefSymbolFile(const DIERef &die_ref) override; 71 72 protected: 73 DIEToTypePtr &GetDIEToType() override; 74 75 DIEToVariableSP &GetDIEToVariable() override; 76 77 llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> & 78 GetForwardDeclCompilerTypeToDIE() override; 79 80 UniqueDWARFASTTypeMap &GetUniqueDWARFASTTypeMap() override; 81 82 DWARFDIE FindDefinitionDIE(const DWARFDIE &die) override; 83 84 lldb::TypeSP 85 FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, 86 ConstString type_name, 87 bool must_be_implementation) override; 88 89 /// If this file contains exactly one compile unit, this function will return 90 /// it. Otherwise it returns nullptr. 91 DWARFCompileUnit *FindSingleCompileUnit(); 92 93 SymbolFileDWARF &m_base_symbol_file; 94 }; 95 } // namespace dwarf 96 } // namespace lldb_private::plugin 97 98 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARFDWO_H 99