LLDB  mainline
ObjectFileJIT.h
Go to the documentation of this file.
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 LLDB_SOURCE_PLUGINS_OBJECTFILE_JIT_OBJECTFILEJIT_H
10 #define LLDB_SOURCE_PLUGINS_OBJECTFILE_JIT_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
18 public:
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 
30 
31  static const char *GetPluginDescriptionStatic();
32 
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 
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,
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 
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 
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
88  lldb_private::DataExtractor &section_data) override;
89 
91 
93 
94  ObjectFile::Type CalculateType() override;
95 
96  ObjectFile::Strata CalculateStrata() override;
97 
98  // PluginInterface protocol
100 
101  uint32_t GetPluginVersion() override;
102 
103 protected:
104  lldb::ObjectFileJITDelegateWP m_delegate_wp;
105 };
106 
107 #endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_JIT_OBJECTFILEJIT_H
lldb_private::UUID
Definition: UUID.h:23
ObjectFileJIT::isA
bool isA(const void *ClassID) const override
Definition: ObjectFileJIT.h:51
ObjectFileJIT
Definition: ObjectFileJIT.h:17
lldb_private::ArchSpec
Definition: ArchSpec.h:33
ObjectFileJIT::ParseHeader
bool ParseHeader() override
Attempts to parse the object header.
Definition: ObjectFileJIT.cpp:105
ObjectFileJIT::GetPluginName
lldb_private::ConstString GetPluginName() override
Definition: ObjectFileJIT.cpp:203
ObjectFileJIT::CreateInstance
static lldb_private::ObjectFile * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const lldb_private::FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
Definition: ObjectFileJIT.cpp:65
ObjectFileJIT::GetByteOrder
lldb::ByteOrder GetByteOrder() const override
Gets whether endian swapping should occur when extracting data from this object file.
Definition: ObjectFileJIT.cpp:110
ObjectFileJIT::ID
static char ID
Definition: ObjectFileJIT.h:50
lldb_private::ModuleSpecList
Definition: ModuleSpec.h:281
ObjectFileJIT::classof
static bool classof(const ObjectFile *obj)
Definition: ObjectFileJIT.h:54
lldb_private::ObjectFile::ObjectFile
ObjectFile(const lldb::ModuleSP &module_sp, const FileSpec *file_spec_ptr, lldb::offset_t file_offset, lldb::offset_t length, const lldb::DataBufferSP &data_sp, lldb::offset_t data_offset)
Construct with a parent module, offset, and header data.
Definition: ObjectFile.cpp:237
lldb_private::SectionList
Definition: Section.h:34
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
ObjectFileJIT::CalculateStrata
ObjectFile::Strata CalculateStrata() override
The object file should be able to calculate the strata of the object file.
Definition: ObjectFileJIT.cpp:194
lldb_private::Stream
Definition: Stream.h:28
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::Target
Definition: Target.h:445
ObjectFileJIT::GetSymtab
lldb_private::Symtab * GetSymtab() override
Gets the symbol table for the currently selected architecture (and object for archives).
Definition: ObjectFileJIT.cpp:118
ObjectFileJIT::GetAddressByteSize
uint32_t GetAddressByteSize() const override
Gets the address size in bytes for the current object file.
Definition: ObjectFileJIT.cpp:114
lldb_private::FileSpec
Definition: FileSpec.h:56
ObjectFileJIT::IsExecutable
bool IsExecutable() const override
Tells whether this object file is capable of being the main executable for a process.
Definition: ObjectFileJIT.cpp:112
ObjectFileJIT::GetModuleSpecifications
static size_t GetModuleSpecifications(const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t length, lldb_private::ModuleSpecList &specs)
Definition: ObjectFileJIT.cpp:85
lldb_private::DataExtractor
Definition: DataExtractor.h:48
ObjectFileJIT::GetDependentModules
uint32_t GetDependentModules(lldb_private::FileSpecList &files) override
Definition: ObjectFileJIT.cpp:179
ObjectFileJIT::Initialize
static void Initialize()
Definition: ObjectFileJIT.cpp:46
lldb_private::ConstString
Definition: ConstString.h:40
ObjectFileJIT::SetLoadAddress
bool SetLoadAddress(lldb_private::Target &target, lldb::addr_t value, bool value_is_offset) override
Sets the load address for an entire module, assuming a rigid slide of sections, if possible in the im...
Definition: ObjectFileJIT.cpp:209
ObjectFileJIT::ReadSectionData
size_t ReadSectionData(lldb_private::Section *section, lldb::offset_t section_offset, void *dst, size_t dst_len) override
Definition: ObjectFileJIT.cpp:231
ObjectFileJIT::~ObjectFileJIT
~ObjectFileJIT() override
Definition: ObjectFileJIT.cpp:103
Address.h
ObjectFileJIT::ObjectFileJIT
ObjectFileJIT(const lldb::ModuleSP &module_sp, const lldb::ObjectFileJITDelegateSP &delegate_sp)
Definition: ObjectFileJIT.cpp:93
ObjectFile.h
ObjectFileJIT::GetEntryPointAddress
lldb_private::Address GetEntryPointAddress() override
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry...
Definition: ObjectFileJIT.cpp:186
lldb_private::Section
Definition: Section.h:96
ObjectFileJIT::Terminate
static void Terminate()
Definition: ObjectFileJIT.cpp:52
ObjectFileJIT::CreateMemoryInstance
static lldb_private::ObjectFile * CreateMemoryInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr)
Definition: ObjectFileJIT.cpp:76
lldb_private::Symtab
Definition: Symtab.h:21
uint32_t
lldb_private::Address
Definition: Address.h:59
ObjectFileJIT::GetArchitecture
lldb_private::ArchSpec GetArchitecture() override
Get the ArchSpec for this object file.
Definition: ObjectFileJIT.cpp:196
ObjectFileJIT::CreateSections
void CreateSections(lldb_private::SectionList &unified_section_list) override
Definition: ObjectFileJIT.cpp:140
ObjectFileJIT::m_delegate_wp
lldb::ObjectFileJITDelegateWP m_delegate_wp
Definition: ObjectFileJIT.h:104
ObjectFileJIT::CalculateType
ObjectFile::Type CalculateType() override
The object file should be able to calculate its type by looking at its file header and possibly the s...
Definition: ObjectFileJIT.cpp:192
ObjectFileJIT::GetPluginDescriptionStatic
static const char * GetPluginDescriptionStatic()
Definition: ObjectFileJIT.cpp:61
ObjectFileJIT::IsStripped
bool IsStripped() override
Detect if this object file has been stripped of local symbols.
Definition: ObjectFileJIT.cpp:136
ObjectFileJIT::GetPluginNameStatic
static lldb_private::ConstString GetPluginNameStatic()
Definition: ObjectFileJIT.cpp:56
ObjectFileJIT::GetPluginVersion
uint32_t GetPluginVersion() override
Definition: ObjectFileJIT.cpp:207
ObjectFileJIT::GetUUID
lldb_private::UUID GetUUID() override
Gets the UUID for this object file.
Definition: ObjectFileJIT.cpp:174
ObjectFileJIT::GetBaseAddress
lldb_private::Address GetBaseAddress() override
Returns base address of this object file.
Definition: ObjectFileJIT.cpp:190
ObjectFileJIT::Dump
void Dump(lldb_private::Stream *s) override
Dump a description of this object to a Stream.
Definition: ObjectFileJIT.cpp:151
lldb_private::ObjectFile
Definition: ObjectFile.h:58
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138