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_EXPRESSION_OBJECTFILEJIT_H
10#define LLDB_EXPRESSION_OBJECTFILEJIT_H
11
12#include "lldb/Core/Address.h"
13#include "lldb/Core/Section.h"
15#include "lldb/Symbol/Symtab.h"
17
18namespace lldb_private {
19
21public:
23 virtual ~ObjectFileJITDelegate() = default;
24 virtual lldb::ByteOrder GetByteOrder() const = 0;
25 virtual uint32_t GetAddressByteSize() const = 0;
27 lldb_private::Symtab &symtab) = 0;
29 lldb_private::SectionList &section_list) = 0;
31};
32
33class ObjectFileJIT : public ObjectFile {
34public:
35 ObjectFileJIT(const lldb::ModuleSP &module_sp,
36 const lldb::ObjectFileJITDelegateSP &delegate_sp);
37
38 ~ObjectFileJIT() override;
39
40 // Static Functions
41 static void Initialize();
42
43 static void Terminate();
44
45 static llvm::StringRef GetPluginNameStatic() { return "jit"; }
46
47 static llvm::StringRef GetPluginDescriptionStatic() {
48 return "JIT code object file";
49 }
50
52 CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
53 lldb::offset_t data_offset, const lldb_private::FileSpec *file,
54 lldb::offset_t file_offset, lldb::offset_t length);
55
57 const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
58 const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
59
60 static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
61 lldb::DataBufferSP &data_sp,
62 lldb::offset_t data_offset,
63 lldb::offset_t file_offset,
64 lldb::offset_t length,
66
67 // LLVM RTTI support
68 static char ID;
69 bool isA(const void *ClassID) const override {
70 return ClassID == &ID || ObjectFile::isA(ClassID);
71 }
72 static bool classof(const ObjectFile *obj) { return obj->isA(&ID); }
73
74 // Member Functions
75 bool ParseHeader() override;
76
78 bool value_is_offset) override;
79
80 lldb::ByteOrder GetByteOrder() const override;
81
82 bool IsExecutable() const override;
83
84 uint32_t GetAddressByteSize() const override;
85
86 void ParseSymtab(lldb_private::Symtab &symtab) override;
87
88 bool IsStripped() override;
89
90 void CreateSections(lldb_private::SectionList &unified_section_list) override;
91
92 void Dump(lldb_private::Stream *s) override;
93
95
96 lldb_private::UUID GetUUID() override;
97
98 uint32_t GetDependentModules(lldb_private::FileSpecList &files) override;
99
101 lldb::offset_t section_offset, void *dst,
102 size_t dst_len) override;
103
105 lldb_private::DataExtractor &section_data) override;
106
108
110
112
114
115 // PluginInterface protocol
116 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
117
118protected:
120};
121} // namespace lldb_private
122
123#endif // LLDB_EXPRESSION_OBJECTFILEJIT_H
A section + offset based address class.
Definition: Address.h:62
An architecture specification class.
Definition: ArchSpec.h:31
An data extractor class.
Definition: DataExtractor.h:48
A file collection class.
Definition: FileSpecList.h:91
A file utility class.
Definition: FileSpec.h:56
virtual uint32_t GetAddressByteSize() const =0
virtual ArchSpec GetArchitecture()=0
virtual void PopulateSymtab(lldb_private::ObjectFile *obj_file, lldb_private::Symtab &symtab)=0
virtual void PopulateSectionList(lldb_private::ObjectFile *obj_file, lldb_private::SectionList &section_list)=0
virtual ~ObjectFileJITDelegate()=default
virtual lldb::ByteOrder GetByteOrder() const =0
uint32_t GetDependentModules(lldb_private::FileSpecList &files) override
Extract the dependent modules from an object file.
bool IsStripped() override
Detect if this object file has been stripped of local symbols.
bool IsExecutable() const override
Tells whether this object file is capable of being the main executable for a process.
lldb::ByteOrder GetByteOrder() const override
Gets whether endian swapping should occur when extracting data from this object file.
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)
bool isA(const void *ClassID) const override
Definition: ObjectFileJIT.h:69
lldb_private::Address GetBaseAddress() override
Returns base address of this object file.
static llvm::StringRef GetPluginDescriptionStatic()
Definition: ObjectFileJIT.h:47
lldb_private::UUID GetUUID() override
Gets the UUID for this object file.
static bool classof(const ObjectFile *obj)
Definition: ObjectFileJIT.h:72
lldb_private::ArchSpec GetArchitecture() override
Get the ArchSpec for this object file.
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...
void Dump(lldb_private::Stream *s) override
Dump a description of this object to a Stream.
bool ParseHeader() override
Attempts to parse the object header.
lldb::ObjectFileJITDelegateWP m_delegate_wp
ObjectFile::Strata CalculateStrata() override
The object file should be able to calculate the strata of the object file.
llvm::StringRef GetPluginName() override
uint32_t GetAddressByteSize() const override
Gets the address size in bytes for the current object file.
static llvm::StringRef GetPluginNameStatic()
Definition: ObjectFileJIT.h:45
void CreateSections(lldb_private::SectionList &unified_section_list) override
ObjectFile::Type CalculateType() override
The object file should be able to calculate its type by looking at its file header and possibly the s...
size_t ReadSectionData(lldb_private::Section *section, lldb::offset_t section_offset, void *dst, size_t dst_len) override
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...
void ParseSymtab(lldb_private::Symtab &symtab) override
Parse the symbol table into the provides symbol table object.
static lldb_private::ObjectFile * CreateMemoryInstance(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr)
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)
A plug-in interface definition class for object file parsers.
Definition: ObjectFile.h:44
virtual bool isA(const void *ClassID) const
Definition: ObjectFile.h:211
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
A class that represents a running process on the host machine.
uint64_t offset_t
Definition: lldb-types.h:85
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:387
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:334
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:335
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::ObjectFileJITDelegate > ObjectFileJITDelegateSP
Definition: lldb-forward.h:376
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:371
std::weak_ptr< lldb_private::ObjectFileJITDelegate > ObjectFileJITDelegateWP
Definition: lldb-forward.h:378