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