1 //===-- SymbolFileSymtab.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_SYMTAB_SYMBOLFILESYMTAB_H 10 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_SYMTAB_SYMBOLFILESYMTAB_H 11 12 #include <map> 13 #include <vector> 14 15 #include "lldb/Symbol/SymbolFile.h" 16 #include "lldb/Symbol/Symtab.h" 17 18 class SymbolFileSymtab : public lldb_private::SymbolFile { 19 /// LLVM RTTI support. 20 static char ID; 21 22 public: 23 /// LLVM RTTI support. 24 /// \{ isA(const void * ClassID)25 bool isA(const void *ClassID) const override { 26 return ClassID == &ID || SymbolFile::isA(ClassID); 27 } classof(const SymbolFile * obj)28 static bool classof(const SymbolFile *obj) { return obj->isA(&ID); } 29 /// \} 30 31 // Constructors and Destructors 32 SymbolFileSymtab(lldb::ObjectFileSP objfile_sp); 33 34 // Static Functions 35 static void Initialize(); 36 37 static void Terminate(); 38 39 static lldb_private::ConstString GetPluginNameStatic(); 40 41 static const char *GetPluginDescriptionStatic(); 42 43 static lldb_private::SymbolFile * 44 CreateInstance(lldb::ObjectFileSP objfile_sp); 45 46 uint32_t CalculateAbilities() override; 47 48 // Compile Unit function calls 49 lldb::LanguageType 50 ParseLanguage(lldb_private::CompileUnit &comp_unit) override; 51 52 size_t ParseFunctions(lldb_private::CompileUnit &comp_unit) override; 53 54 bool ParseLineTable(lldb_private::CompileUnit &comp_unit) override; 55 56 bool ParseDebugMacros(lldb_private::CompileUnit &comp_unit) override; 57 58 bool ParseSupportFiles(lldb_private::CompileUnit &comp_unit, 59 lldb_private::FileSpecList &support_files) override; 60 61 size_t ParseTypes(lldb_private::CompileUnit &comp_unit) override; 62 63 bool ParseImportedModules( 64 const lldb_private::SymbolContext &sc, 65 std::vector<lldb_private::SourceModule> &imported_modules) override; 66 67 size_t ParseBlocksRecursive(lldb_private::Function &func) override; 68 69 size_t 70 ParseVariablesForContext(const lldb_private::SymbolContext &sc) override; 71 72 lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override; 73 llvm::Optional<ArrayInfo> GetDynamicArrayInfoForUID( 74 lldb::user_id_t type_uid, 75 const lldb_private::ExecutionContext *exe_ctx) override; 76 77 bool CompleteType(lldb_private::CompilerType &compiler_type) override; 78 79 uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr, 80 lldb::SymbolContextItem resolve_scope, 81 lldb_private::SymbolContext &sc) override; 82 83 void GetTypes(lldb_private::SymbolContextScope *sc_scope, 84 lldb::TypeClass type_mask, 85 lldb_private::TypeList &type_list) override; 86 87 // PluginInterface protocol 88 lldb_private::ConstString GetPluginName() override; 89 90 uint32_t GetPluginVersion() override; 91 92 protected: 93 uint32_t CalculateNumCompileUnits() override; 94 95 lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; 96 97 typedef std::map<lldb_private::ConstString, lldb::TypeSP> TypeMap; 98 99 lldb_private::Symtab::IndexCollection m_source_indexes; 100 lldb_private::Symtab::IndexCollection m_func_indexes; 101 lldb_private::Symtab::IndexCollection m_code_indexes; 102 lldb_private::Symtab::IndexCollection m_data_indexes; 103 lldb_private::Symtab::NameToIndexMap m_objc_class_name_to_index; 104 TypeMap m_objc_class_types; 105 }; 106 107 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_SYMTAB_SYMBOLFILESYMTAB_H 108