Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 1 | //===-- ObjectFileJIT.h -----------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef liblldb_ObjectFileJIT_h_ |
| 11 | #define liblldb_ObjectFileJIT_h_ |
| 12 | |
Eugene Zelenko | 8157a88 | 2015-10-23 16:56:07 +0000 | [diff] [blame] | 13 | // C Includes |
| 14 | // C++ Includes |
| 15 | // Other libraries and framework includes |
| 16 | // Project includes |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 17 | #include "lldb/Core/Address.h" |
| 18 | #include "lldb/Symbol/ObjectFile.h" |
| 19 | |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 20 | //---------------------------------------------------------------------- |
| 21 | // This class needs to be hidden as eventually belongs in a plugin that |
| 22 | // will export the ObjectFile protocol |
| 23 | //---------------------------------------------------------------------- |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 24 | class ObjectFileJIT : public lldb_private::ObjectFile { |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 25 | public: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 26 | ObjectFileJIT(const lldb::ModuleSP &module_sp, |
| 27 | const lldb::ObjectFileJITDelegateSP &delegate_sp); |
Eugene Zelenko | 8157a88 | 2015-10-23 16:56:07 +0000 | [diff] [blame] | 28 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 29 | ~ObjectFileJIT() override; |
Eugene Zelenko | 8157a88 | 2015-10-23 16:56:07 +0000 | [diff] [blame] | 30 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 31 | //------------------------------------------------------------------ |
| 32 | // Static Functions |
| 33 | //------------------------------------------------------------------ |
| 34 | static void Initialize(); |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 35 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 36 | static void Terminate(); |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 37 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 38 | static lldb_private::ConstString GetPluginNameStatic(); |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 39 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 40 | static const char *GetPluginDescriptionStatic(); |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 41 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 42 | static lldb_private::ObjectFile * |
| 43 | CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, |
| 44 | lldb::offset_t data_offset, const lldb_private::FileSpec *file, |
| 45 | lldb::offset_t file_offset, lldb::offset_t length); |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 46 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 47 | static lldb_private::ObjectFile *CreateMemoryInstance( |
| 48 | const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, |
| 49 | const lldb::ProcessSP &process_sp, lldb::addr_t header_addr); |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 50 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 51 | static size_t GetModuleSpecifications(const lldb_private::FileSpec &file, |
| 52 | lldb::DataBufferSP &data_sp, |
| 53 | lldb::offset_t data_offset, |
| 54 | lldb::offset_t file_offset, |
| 55 | lldb::offset_t length, |
| 56 | lldb_private::ModuleSpecList &specs); |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 57 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 58 | //------------------------------------------------------------------ |
| 59 | // Member Functions |
| 60 | //------------------------------------------------------------------ |
| 61 | bool ParseHeader() override; |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 62 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 63 | bool SetLoadAddress(lldb_private::Target &target, lldb::addr_t value, |
| 64 | bool value_is_offset) override; |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 65 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 66 | lldb::ByteOrder GetByteOrder() const override; |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 67 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 68 | bool IsExecutable() const override; |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 69 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 70 | uint32_t GetAddressByteSize() const override; |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 71 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 72 | lldb_private::Symtab *GetSymtab() override; |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 73 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 74 | bool IsStripped() override; |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 75 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 76 | void CreateSections(lldb_private::SectionList &unified_section_list) override; |
Eugene Zelenko | 8157a88 | 2015-10-23 16:56:07 +0000 | [diff] [blame] | 77 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 78 | void Dump(lldb_private::Stream *s) override; |
Eugene Zelenko | 8157a88 | 2015-10-23 16:56:07 +0000 | [diff] [blame] | 79 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 80 | bool GetArchitecture(lldb_private::ArchSpec &arch) override; |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 81 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 82 | bool GetUUID(lldb_private::UUID *uuid) override; |
| 83 | |
| 84 | uint32_t GetDependentModules(lldb_private::FileSpecList &files) override; |
| 85 | |
| 86 | size_t ReadSectionData(const lldb_private::Section *section, |
| 87 | lldb::offset_t section_offset, void *dst, |
| 88 | size_t dst_len) const override; |
| 89 | |
| 90 | size_t |
| 91 | ReadSectionData(const lldb_private::Section *section, |
| 92 | lldb_private::DataExtractor §ion_data) const override; |
| 93 | |
| 94 | lldb_private::Address GetEntryPointAddress() override; |
| 95 | |
| 96 | lldb_private::Address GetHeaderAddress() override; |
| 97 | |
| 98 | ObjectFile::Type CalculateType() override; |
| 99 | |
| 100 | ObjectFile::Strata CalculateStrata() override; |
| 101 | |
| 102 | //------------------------------------------------------------------ |
| 103 | // PluginInterface protocol |
| 104 | //------------------------------------------------------------------ |
| 105 | lldb_private::ConstString GetPluginName() override; |
| 106 | |
| 107 | uint32_t GetPluginVersion() override; |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 108 | |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 109 | protected: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 110 | lldb::ObjectFileJITDelegateWP m_delegate_wp; |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 111 | }; |
| 112 | |
Eugene Zelenko | 8157a88 | 2015-10-23 16:56:07 +0000 | [diff] [blame] | 113 | #endif // liblldb_ObjectFileJIT_h_ |