1//===-- ObjectFileJIT.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 liblldb_ObjectFileJIT_h_ 10#define liblldb_ObjectFileJIT_h_ 11 12#include "lldb/Core/Address.h" 13#include "lldb/Symbol/ObjectFile.h" 14 15// This class needs to be hidden as eventually belongs in a plugin that 16// will export the ObjectFile protocol 17class ObjectFileJIT : public lldb_private::ObjectFile { 18public: 19 ObjectFileJIT(const lldb::ModuleSP &module_sp, 20 const lldb::ObjectFileJITDelegateSP &delegate_sp); 21 22 ~ObjectFileJIT() override; 23 24 // Static Functions 25 static void Initialize(); 26 27 static void Terminate(); 28 29 static lldb_private::ConstString GetPluginNameStatic(); 30 31 static const char *GetPluginDescriptionStatic(); 32 33 static lldb_private::ObjectFile * 34 CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, 35 lldb::offset_t data_offset, const lldb_private::FileSpec *file, 36 lldb::offset_t file_offset, lldb::offset_t length); 37 38 static lldb_private::ObjectFile *CreateMemoryInstance( 39 const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, 40 const lldb::ProcessSP &process_sp, lldb::addr_t header_addr); 41 42 static size_t GetModuleSpecifications(const lldb_private::FileSpec &file, 43 lldb::DataBufferSP &data_sp, 44 lldb::offset_t data_offset, 45 lldb::offset_t file_offset, 46 lldb::offset_t length, 47 lldb_private::ModuleSpecList &specs); 48 49 // LLVM RTTI support 50 static char ID; 51 bool isA(const void *ClassID) const override { 52 return ClassID == &ID || ObjectFile::isA(ClassID); 53 } 54 static bool classof(const ObjectFile *obj) { return obj->isA(&ID); } 55 56 // Member Functions 57 bool ParseHeader() override; 58 59 bool SetLoadAddress(lldb_private::Target &target, lldb::addr_t value, 60 bool value_is_offset) override; 61 62 lldb::ByteOrder GetByteOrder() const override; 63 64 bool IsExecutable() const override; 65 66 uint32_t GetAddressByteSize() const override; 67 68 lldb_private::Symtab *GetSymtab() override; 69 70 bool IsStripped() override; 71 72 void CreateSections(lldb_private::SectionList &unified_section_list) override; 73 74 void Dump(lldb_private::Stream *s) override; 75 76 lldb_private::ArchSpec GetArchitecture() override; 77 78 lldb_private::UUID GetUUID() override; 79 80 uint32_t GetDependentModules(lldb_private::FileSpecList &files) override; 81 82 size_t ReadSectionData(lldb_private::Section *section, 83 lldb::offset_t section_offset, void *dst, 84 size_t dst_len) override; 85 86 size_t 87 ReadSectionData(lldb_private::Section *section, 88 lldb_private::DataExtractor §ion_data) override; 89 90 lldb_private::Address GetEntryPointAddress() override; 91 92 lldb_private::Address GetBaseAddress() override; 93 94 ObjectFile::Type CalculateType() override; 95 96 ObjectFile::Strata CalculateStrata() override; 97 98 // PluginInterface protocol 99 lldb_private::ConstString GetPluginName() override; 100 101 uint32_t GetPluginVersion() override; 102 103protected: 104 lldb::ObjectFileJITDelegateWP m_delegate_wp; 105}; 106 107#endif // liblldb_ObjectFileJIT_h_ 108