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 
13 #include "lldb/Core/Address.h"
14 #include "lldb/Symbol/ObjectFile.h"
15 
16 
17 //----------------------------------------------------------------------
18 // This class needs to be hidden as eventually belongs in a plugin that
19 // will export the ObjectFile protocol
20 //----------------------------------------------------------------------
21 class ObjectFileJIT :
22     public lldb_private::ObjectFile
23 {
24 public:
25     //------------------------------------------------------------------
26     // Static Functions
27     //------------------------------------------------------------------
28     static void
29     Initialize();
30 
31     static void
32     Terminate();
33 
34     static lldb_private::ConstString
35     GetPluginNameStatic();
36 
37     static const char *
38     GetPluginDescriptionStatic();
39 
40     static lldb_private::ObjectFile *
41     CreateInstance (const lldb::ModuleSP &module_sp,
42                     lldb::DataBufferSP& data_sp,
43                     lldb::offset_t data_offset,
44                     const lldb_private::FileSpec* file,
45                     lldb::offset_t file_offset,
46                     lldb::offset_t length);
47 
48     static lldb_private::ObjectFile *
49     CreateMemoryInstance (const lldb::ModuleSP &module_sp,
50                           lldb::DataBufferSP& data_sp,
51                           const lldb::ProcessSP &process_sp,
52                           lldb::addr_t header_addr);
53 
54     static size_t
55     GetModuleSpecifications (const lldb_private::FileSpec& file,
56                              lldb::DataBufferSP& data_sp,
57                              lldb::offset_t data_offset,
58                              lldb::offset_t file_offset,
59                              lldb::offset_t length,
60                              lldb_private::ModuleSpecList &specs);
61 
62     //------------------------------------------------------------------
63     // Member Functions
64     //------------------------------------------------------------------
65     ObjectFileJIT (const lldb::ModuleSP &module_sp,
66                    const lldb::ObjectFileJITDelegateSP &delegate_sp);
67 
68     virtual
69     ~ObjectFileJIT();
70 
71     virtual bool
72     ParseHeader ();
73 
74     virtual bool
75     SetLoadAddress(lldb_private::Target &target,
76                    lldb::addr_t value,
77                    bool value_is_offset);
78 
79     virtual lldb::ByteOrder
80     GetByteOrder () const;
81 
82     virtual bool
83     IsExecutable () const;
84 
85     virtual uint32_t
86     GetAddressByteSize ()  const;
87 
88     virtual lldb_private::Symtab *
89     GetSymtab();
90 
91     virtual bool
92     IsStripped ();
93 
94     virtual void
95     CreateSections (lldb_private::SectionList &unified_section_list);
96 
97     virtual void
98     Dump (lldb_private::Stream *s);
99 
100     virtual bool
101     GetArchitecture (lldb_private::ArchSpec &arch);
102 
103     virtual bool
104     GetUUID (lldb_private::UUID* uuid);
105 
106     virtual uint32_t
107     GetDependentModules (lldb_private::FileSpecList& files);
108 
109     virtual size_t
110     ReadSectionData (const lldb_private::Section *section,
111                      off_t section_offset,
112                      void *dst,
113                      size_t dst_len) const;
114     virtual size_t
115     ReadSectionData (const lldb_private::Section *section,
116                      lldb_private::DataExtractor& section_data) const;
117 
118     //------------------------------------------------------------------
119     // PluginInterface protocol
120     //------------------------------------------------------------------
121     virtual lldb_private::ConstString
122     GetPluginName();
123 
124     virtual uint32_t
125     GetPluginVersion();
126 
127     virtual lldb_private::Address
128     GetEntryPointAddress ();
129 
130     virtual lldb_private::Address
131     GetHeaderAddress ();
132 
133     virtual ObjectFile::Type
134     CalculateType();
135 
136     virtual ObjectFile::Strata
137     CalculateStrata();
138 protected:
139     lldb::ObjectFileJITDelegateWP m_delegate_wp;
140 };
141 
142 #endif  // liblldb_ObjectFileJIT_h_
143