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 
29  static llvm::StringRef GetPluginNameStatic() { return "jit"; }
30 
31  static llvm::StringRef GetPluginDescriptionStatic() {
32  return "JIT code object file";
33  }
34 
36  CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
37  lldb::offset_t data_offset, const lldb_private::FileSpec *file,
38  lldb::offset_t file_offset, lldb::offset_t length);
39 
41  const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
42  const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
43 
44  static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
45  lldb::DataBufferSP &data_sp,
46  lldb::offset_t data_offset,
47  lldb::offset_t file_offset,
48  lldb::offset_t length,
50 
51  // LLVM RTTI support
52  static char ID;
53  bool isA(const void *ClassID) const override {
54  return ClassID == &ID || ObjectFile::isA(ClassID);
55  }
56  static bool classof(const ObjectFile *obj) { return obj->isA(&ID); }
57 
58  // Member Functions
59  bool ParseHeader() override;
60 
62  bool value_is_offset) override;
63 
64  lldb::ByteOrder GetByteOrder() const override;
65 
66  bool IsExecutable() const override;
67 
68  uint32_t GetAddressByteSize() const override;
69 
70  lldb_private::Symtab *GetSymtab() override;
71 
72  bool IsStripped() override;
73 
74  void CreateSections(lldb_private::SectionList &unified_section_list) override;
75 
76  void Dump(lldb_private::Stream *s) override;
77 
79 
80  lldb_private::UUID GetUUID() override;
81 
82  uint32_t GetDependentModules(lldb_private::FileSpecList &files) override;
83 
84  size_t ReadSectionData(lldb_private::Section *section,
85  lldb::offset_t section_offset, void *dst,
86  size_t dst_len) override;
87 
88  size_t
90  lldb_private::DataExtractor &section_data) override;
91 
93 
95 
96  ObjectFile::Type CalculateType() override;
97 
98  ObjectFile::Strata CalculateStrata() override;
99 
100  // PluginInterface protocol
101  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
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:53
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:96
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:56
ObjectFileJIT::GetByteOrder
lldb::ByteOrder GetByteOrder() const override
Gets whether endian swapping should occur when extracting data from this object file.
Definition: ObjectFileJIT.cpp:101
ObjectFileJIT::ID
static char ID
Definition: ObjectFileJIT.h:52
lldb_private::ModuleSpecList
Definition: ModuleSpec.h:280
ObjectFileJIT::classof
static bool classof(const ObjectFile *obj)
Definition: ObjectFileJIT.h:56
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
ObjectFileJIT::GetPluginName
llvm::StringRef GetPluginName() override
Definition: ObjectFileJIT.h:101
lldb_private::SectionList
Definition: Section.h:34
ObjectFileJIT::GetPluginDescriptionStatic
static llvm::StringRef GetPluginDescriptionStatic()
Definition: ObjectFileJIT.h:31
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:186
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:451
ObjectFileJIT::GetSymtab
lldb_private::Symtab * GetSymtab() override
Gets the symbol table for the currently selected architecture (and object for archives).
Definition: ObjectFileJIT.cpp:109
ObjectFileJIT::GetAddressByteSize
uint32_t GetAddressByteSize() const override
Gets the address size in bytes for the current object file.
Definition: ObjectFileJIT.cpp:105
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:103
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:76
lldb_private::DataExtractor
Definition: DataExtractor.h:48
ObjectFileJIT::GetDependentModules
uint32_t GetDependentModules(lldb_private::FileSpecList &files) override
Definition: ObjectFileJIT.cpp:171
ObjectFileJIT::Initialize
static void Initialize()
Definition: ObjectFileJIT.cpp:46
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:194
ObjectFileJIT::ReadSectionData
size_t ReadSectionData(lldb_private::Section *section, lldb::offset_t section_offset, void *dst, size_t dst_len) override
Definition: ObjectFileJIT.cpp:216
ObjectFileJIT::~ObjectFileJIT
~ObjectFileJIT() override
ObjectFileJIT::GetPluginNameStatic
static llvm::StringRef GetPluginNameStatic()
Definition: ObjectFileJIT.h:29
Address.h
ObjectFileJIT::ObjectFileJIT
ObjectFileJIT(const lldb::ModuleSP &module_sp, const lldb::ObjectFileJITDelegateSP &delegate_sp)
Definition: ObjectFileJIT.cpp:84
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:178
lldb_private::Section
Definition: Section.h:102
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:67
lldb_private::Symtab
Definition: Symtab.h:22
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:188
ObjectFileJIT::CreateSections
void CreateSections(lldb_private::SectionList &unified_section_list) override
Definition: ObjectFileJIT.cpp:132
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:184
ObjectFileJIT::IsStripped
bool IsStripped() override
Detect if this object file has been stripped of local symbols.
Definition: ObjectFileJIT.cpp:128
ObjectFileJIT::GetUUID
lldb_private::UUID GetUUID() override
Gets the UUID for this object file.
Definition: ObjectFileJIT.cpp:166
ObjectFileJIT::GetBaseAddress
lldb_private::Address GetBaseAddress() override
Returns base address of this object file.
Definition: ObjectFileJIT.cpp:182
ObjectFileJIT::Dump
void Dump(lldb_private::Stream *s) override
Dump a description of this object to a Stream.
Definition: ObjectFileJIT.cpp:143
lldb_private::ObjectFile
Definition: ObjectFile.h:58
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138