blob: 39dbb3fb047b46a64b266598771c6d35eda2f2fa [file] [log] [blame]
Greg Clayton23f8c952014-03-24 23:10:19 +00001//===-- 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 Zelenko8157a882015-10-23 16:56:07 +000013// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
Greg Clayton23f8c952014-03-24 23:10:19 +000017#include "lldb/Core/Address.h"
18#include "lldb/Symbol/ObjectFile.h"
19
Greg Clayton23f8c952014-03-24 23:10:19 +000020//----------------------------------------------------------------------
21// This class needs to be hidden as eventually belongs in a plugin that
22// will export the ObjectFile protocol
23//----------------------------------------------------------------------
24class ObjectFileJIT :
25 public lldb_private::ObjectFile
26{
27public:
Eugene Zelenko8157a882015-10-23 16:56:07 +000028 ObjectFileJIT(const lldb::ModuleSP &module_sp,
29 const lldb::ObjectFileJITDelegateSP &delegate_sp);
30
31 ~ObjectFileJIT() override;
32
Greg Clayton23f8c952014-03-24 23:10:19 +000033 //------------------------------------------------------------------
34 // Static Functions
35 //------------------------------------------------------------------
36 static void
37 Initialize();
38
39 static void
40 Terminate();
41
42 static lldb_private::ConstString
43 GetPluginNameStatic();
44
45 static const char *
46 GetPluginDescriptionStatic();
47
48 static lldb_private::ObjectFile *
49 CreateInstance (const lldb::ModuleSP &module_sp,
50 lldb::DataBufferSP& data_sp,
51 lldb::offset_t data_offset,
52 const lldb_private::FileSpec* file,
53 lldb::offset_t file_offset,
54 lldb::offset_t length);
55
56 static lldb_private::ObjectFile *
57 CreateMemoryInstance (const lldb::ModuleSP &module_sp,
58 lldb::DataBufferSP& data_sp,
59 const lldb::ProcessSP &process_sp,
60 lldb::addr_t header_addr);
61
62 static size_t
63 GetModuleSpecifications (const lldb_private::FileSpec& file,
64 lldb::DataBufferSP& data_sp,
65 lldb::offset_t data_offset,
66 lldb::offset_t file_offset,
67 lldb::offset_t length,
68 lldb_private::ModuleSpecList &specs);
69
70 //------------------------------------------------------------------
71 // Member Functions
72 //------------------------------------------------------------------
Eugene Zelenko8157a882015-10-23 16:56:07 +000073 bool
74 ParseHeader() override;
Greg Clayton23f8c952014-03-24 23:10:19 +000075
Eugene Zelenko8157a882015-10-23 16:56:07 +000076 bool
Greg Clayton23f8c952014-03-24 23:10:19 +000077 SetLoadAddress(lldb_private::Target &target,
78 lldb::addr_t value,
Eugene Zelenko8157a882015-10-23 16:56:07 +000079 bool value_is_offset) override;
Greg Clayton23f8c952014-03-24 23:10:19 +000080
Eugene Zelenko8157a882015-10-23 16:56:07 +000081 lldb::ByteOrder
82 GetByteOrder() const override;
Greg Clayton23f8c952014-03-24 23:10:19 +000083
Eugene Zelenko8157a882015-10-23 16:56:07 +000084 bool
85 IsExecutable() const override;
Greg Clayton23f8c952014-03-24 23:10:19 +000086
Eugene Zelenko8157a882015-10-23 16:56:07 +000087 uint32_t
88 GetAddressByteSize() const override;
Greg Clayton23f8c952014-03-24 23:10:19 +000089
Eugene Zelenko8157a882015-10-23 16:56:07 +000090 lldb_private::Symtab *
91 GetSymtab() override;
Greg Clayton23f8c952014-03-24 23:10:19 +000092
Eugene Zelenko8157a882015-10-23 16:56:07 +000093 bool
94 IsStripped() override;
Greg Clayton23f8c952014-03-24 23:10:19 +000095
Eugene Zelenko8157a882015-10-23 16:56:07 +000096 void
97 CreateSections(lldb_private::SectionList &unified_section_list) override;
Greg Clayton23f8c952014-03-24 23:10:19 +000098
Eugene Zelenko8157a882015-10-23 16:56:07 +000099 void
100 Dump(lldb_private::Stream *s) override;
Greg Clayton23f8c952014-03-24 23:10:19 +0000101
Eugene Zelenko8157a882015-10-23 16:56:07 +0000102 bool
103 GetArchitecture(lldb_private::ArchSpec &arch) override;
Greg Clayton23f8c952014-03-24 23:10:19 +0000104
Eugene Zelenko8157a882015-10-23 16:56:07 +0000105 bool
106 GetUUID(lldb_private::UUID* uuid) override;
Greg Clayton23f8c952014-03-24 23:10:19 +0000107
Eugene Zelenko8157a882015-10-23 16:56:07 +0000108 uint32_t
109 GetDependentModules(lldb_private::FileSpecList& files) override;
Greg Clayton23f8c952014-03-24 23:10:19 +0000110
Eugene Zelenko8157a882015-10-23 16:56:07 +0000111 size_t
112 ReadSectionData(const lldb_private::Section *section,
113 lldb::offset_t section_offset,
114 void *dst,
115 size_t dst_len) const override;
116
117 size_t
118 ReadSectionData(const lldb_private::Section *section,
119 lldb_private::DataExtractor& section_data) const override;
Greg Clayton23f8c952014-03-24 23:10:19 +0000120
Eugene Zelenko8157a882015-10-23 16:56:07 +0000121 lldb_private::Address
122 GetEntryPointAddress() override;
123
124 lldb_private::Address
125 GetHeaderAddress() override;
126
127 ObjectFile::Type
128 CalculateType() override;
129
130 ObjectFile::Strata
131 CalculateStrata() override;
132
Greg Clayton23f8c952014-03-24 23:10:19 +0000133 //------------------------------------------------------------------
134 // PluginInterface protocol
135 //------------------------------------------------------------------
Eugene Zelenko8157a882015-10-23 16:56:07 +0000136 lldb_private::ConstString
137 GetPluginName() override;
Greg Clayton23f8c952014-03-24 23:10:19 +0000138
Eugene Zelenko8157a882015-10-23 16:56:07 +0000139 uint32_t
140 GetPluginVersion() override;
Greg Clayton23f8c952014-03-24 23:10:19 +0000141
Greg Clayton23f8c952014-03-24 23:10:19 +0000142protected:
143 lldb::ObjectFileJITDelegateWP m_delegate_wp;
144};
145
Eugene Zelenko8157a882015-10-23 16:56:07 +0000146#endif // liblldb_ObjectFileJIT_h_