ObjectFileJIT.h revision 296417
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// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/Core/Address.h"
18#include "lldb/Symbol/ObjectFile.h"
19
20//----------------------------------------------------------------------
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:
28    ObjectFileJIT(const lldb::ModuleSP &module_sp,
29                  const lldb::ObjectFileJITDelegateSP &delegate_sp);
30
31    ~ObjectFileJIT() override;
32
33    //------------------------------------------------------------------
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    //------------------------------------------------------------------
73    bool
74    ParseHeader() override;
75
76    bool
77    SetLoadAddress(lldb_private::Target &target,
78                   lldb::addr_t value,
79                   bool value_is_offset) override;
80
81    lldb::ByteOrder
82    GetByteOrder() const override;
83
84    bool
85    IsExecutable() const override;
86
87    uint32_t
88    GetAddressByteSize() const override;
89
90    lldb_private::Symtab *
91    GetSymtab() override;
92
93    bool
94    IsStripped() override;
95
96    void
97    CreateSections(lldb_private::SectionList &unified_section_list) override;
98
99    void
100    Dump(lldb_private::Stream *s) override;
101
102    bool
103    GetArchitecture(lldb_private::ArchSpec &arch) override;
104
105    bool
106    GetUUID(lldb_private::UUID* uuid) override;
107
108    uint32_t
109    GetDependentModules(lldb_private::FileSpecList& files) override;
110
111    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;
120
121    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
133    //------------------------------------------------------------------
134    // PluginInterface protocol
135    //------------------------------------------------------------------
136    lldb_private::ConstString
137    GetPluginName() override;
138
139    uint32_t
140    GetPluginVersion() override;
141
142protected:
143    lldb::ObjectFileJITDelegateWP m_delegate_wp;
144};
145
146#endif // liblldb_ObjectFileJIT_h_
147