1//===-- SymbolFileJSON.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_JSON_SYMBOLFILEJSON_H 10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_JSON_SYMBOLFILEJSON_H 11 12#include <map> 13#include <optional> 14#include <vector> 15 16#include "lldb/Symbol/CompileUnit.h" 17#include "lldb/Symbol/SymbolFile.h" 18 19namespace lldb_private { 20 21class SymbolFileJSON : public lldb_private::SymbolFileCommon { 22 /// LLVM RTTI support. 23 static char ID; 24 25public: 26 /// LLVM RTTI support. 27 /// \{ 28 bool isA(const void *ClassID) const override { 29 return ClassID == &ID || SymbolFileCommon::isA(ClassID); 30 } 31 static bool classof(const SymbolFile *obj) { return obj->isA(&ID); } 32 /// \} 33 34 SymbolFileJSON(lldb::ObjectFileSP objfile_sp); 35 36 static void Initialize(); 37 38 static void Terminate(); 39 40 static llvm::StringRef GetPluginNameStatic() { return "JSON"; } 41 42 static llvm::StringRef GetPluginDescriptionStatic(); 43 44 static lldb_private::SymbolFile * 45 CreateInstance(lldb::ObjectFileSP objfile_sp); 46 47 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } 48 49 uint32_t CalculateAbilities() override; 50 51 lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) override { 52 return lldb::eLanguageTypeUnknown; 53 } 54 55 size_t ParseFunctions(CompileUnit &comp_unit) override { return 0; } 56 57 bool ParseLineTable(CompileUnit &comp_unit) override { return false; } 58 59 bool ParseDebugMacros(CompileUnit &comp_unit) override { return false; } 60 61 bool ParseSupportFiles(CompileUnit &comp_unit, 62 SupportFileList &support_files) override { 63 return false; 64 } 65 66 size_t ParseTypes(CompileUnit &cu) override { return 0; } 67 68 bool ParseImportedModules( 69 const SymbolContext &sc, 70 std::vector<lldb_private::SourceModule> &imported_modules) override { 71 return false; 72 } 73 74 size_t ParseBlocksRecursive(Function &func) override { return 0; } 75 76 size_t ParseVariablesForContext(const SymbolContext &sc) override { 77 return 0; 78 } 79 80 uint32_t CalculateNumCompileUnits() override { return 0; } 81 82 lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; 83 84 Type *ResolveTypeUID(lldb::user_id_t type_uid) override { return nullptr; } 85 std::optional<ArrayInfo> GetDynamicArrayInfoForUID( 86 lldb::user_id_t type_uid, 87 const lldb_private::ExecutionContext *exe_ctx) override { 88 return std::nullopt; 89 } 90 91 bool CompleteType(CompilerType &compiler_type) override { return false; } 92 93 uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr, 94 lldb::SymbolContextItem resolve_scope, 95 lldb_private::SymbolContext &sc) override; 96 97 void GetTypes(lldb_private::SymbolContextScope *sc_scope, 98 lldb::TypeClass type_mask, 99 lldb_private::TypeList &type_list) override; 100 101 void AddSymbols(Symtab &symtab) override; 102 103private: 104 lldb::addr_t GetBaseFileAddress(); 105 106 std::vector<std::pair<uint64_t, std::string>> m_symbols; 107}; 108} // namespace lldb_private 109 110#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_JSON_SYMBOLFILEJSON_H 111