Go to the documentation of this file.
9 #include "llvm/ADT/StringRef.h"
47 PluginManager::RegisterPlugin(GetPluginNameStatic(),
48 GetPluginDescriptionStatic(), CreateInstance,
49 CreateMemoryInstance, GetModuleSpecifications);
53 PluginManager::UnregisterPlugin(CreateInstance);
68 WritableDataBufferSP data_sp,
69 const ProcessSP &process_sp,
85 const ObjectFileJITDelegateSP &delegate_sp)
86 :
ObjectFile(module_sp, nullptr, 0, 0, DataBufferSP(), 0), m_delegate_wp() {
112 delegate_sp->PopulateSymtab(
this, symtab);
133 std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
134 s->
Printf(
"%p: ",
static_cast<void *
>(
this));
139 *s <<
", arch = " << arch.GetArchitectureName();
176 if (ObjectFileJITDelegateSP delegate_sp =
m_delegate_wp.lock())
177 return delegate_sp->GetArchitecture();
182 bool value_is_offset) {
183 size_t num_loaded_sections = 0;
186 const size_t num_sections = section_list->
GetSize();
188 for (
size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx) {
192 if (section_sp && section_sp->GetFileSize() > 0 &&
193 !section_sp->IsThreadSpecific()) {
195 section_sp, section_sp->GetFileAddress() + value))
196 ++num_loaded_sections;
200 return num_loaded_sections > 0;
207 if (section_offset < file_size) {
208 size_t src_len = file_size - section_offset;
209 if (src_len > dst_len)
212 ((uint8_t *)(uintptr_t)section->
GetFileOffset()) + section_offset;
214 memcpy(dst, src, src_len);
224 const void *src = (
void *)(uintptr_t)section->
GetFileOffset();
226 DataBufferSP data_sp =
227 std::make_shared<DataBufferHeap>(src, section->
GetFileSize());
228 section_data.
SetData(data_sp, 0, data_sp->GetByteSize());
233 section_data.
Clear();
bool SetSectionLoadAddress(const lldb::SectionSP §ion_sp, lldb::addr_t load_addr, bool warn_multiple=false)
bool ParseHeader() override
Attempts to parse the object header.
void Dump(llvm::raw_ostream &s, unsigned indent, Target *target, bool show_header, uint32_t depth) const
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)
lldb::ByteOrder GetByteOrder() const override
Gets whether endian swapping should occur when extracting data from this object file.
std::unique_ptr< lldb_private::Symtab > m_symtab_up
lldb::offset_t GetFileSize() const
ObjectFile::Strata CalculateStrata() override
The object file should be able to calculate the strata of the object file.
uint32_t GetAddressByteSize() const override
Gets the address size in bytes for the current object file.
virtual SectionList * GetSectionList(bool update_module_section_list=true)
Gets the section list for the currently selected architecture (and object for archives).
bool IsExecutable() const override
Tells whether this object file is capable of being the main executable for a process.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
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)
uint32_t GetDependentModules(lldb_private::FileSpecList &files) override
static lldb_private::ObjectFile * CreateMemoryInstance(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr)
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...
size_t ReadSectionData(lldb_private::Section *section, lldb::offset_t section_offset, void *dst, size_t dst_len) override
~ObjectFileJIT() override
lldb::SectionSP GetSectionAtIndex(size_t idx) const
unsigned GetIndentLevel() const
Get the current indentation level.
ObjectFileJIT(const lldb::ModuleSP &module_sp, const lldb::ObjectFileJITDelegateSP &delegate_sp)
@ eTypeJIT
JIT code that has symbols, sections and possibly debug info.
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 ParseSymtab(lldb_private::Symtab &symtab) override
Parse the symbol table into the provides symbol table object.
size_t EOL()
Output and End of Line character to the stream.
lldb_private::ArchSpec GetArchitecture() override
Get the ArchSpec for this object file.
void CreateSections(lldb_private::SectionList &unified_section_list) override
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
DataExtractor m_data
The data for this object file so things can be parsed lazily.
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
lldb::ObjectFileJITDelegateWP m_delegate_wp
ObjectFile::Type CalculateType() override
The object file should be able to calculate its type by looking at its file header and possibly the s...
SectionLoadList & GetSectionLoadList()
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
bool IsStripped() override
Detect if this object file has been stripped of local symbols.
A class that represents a running process on the host machine.
lldb::offset_t GetFileOffset() const
lldb_private::UUID GetUUID() override
Gets the UUID for this object file.
#define LLDB_PLUGIN_DEFINE(PluginName)
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
lldb_private::Address GetBaseAddress() override
Returns base address of this object file.
void Dump(lldb_private::Stream *s) override
Dump a description of this object to a Stream.
std::unique_ptr< lldb_private::SectionList > m_sections_up
ByteOrder
Byte ordering definitions.