9#ifndef LLDB_EXPRESSION_IREXECUTIONUNIT_H
10#define LLDB_EXPRESSION_IREXECUTIONUNIT_H
17#include "llvm/ExecutionEngine/SectionMemoryManager.h"
18#include "llvm/IR/Module.h"
62 std::unique_ptr<llvm::Module> &module_up,
ConstString &name,
64 std::vector<std::string> &cpu_features);
221 const std::vector<ConstString> &C_names,
226 bool &symbol_was_missing_weak);
258 llvm::StringRef SectionName)
override;
278 llvm::StringRef SectionName,
279 bool IsReadOnly)
override;
299 size_t Size)
override {}
309 llvm::JITSymbol
findSymbol(
const std::string &Name)
override;
312 bool AbortOnFailure =
true)
override;
349 unsigned alignment,
unsigned section_id,
const char *name)
361 AllocationRecord &record);
369 std::unique_ptr<llvm::Module>
static llvm::raw_ostream & error(Stream &strm)
An architecture specification class.
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
void * getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure=true) override
void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) override
bool finalizeMemory(std::string *ErrMsg) override
Called when object loading is complete and section page permissions can be applied.
void deregisterEHFrames() override
std::unique_ptr< SectionMemoryManager > m_default_mm_up
The memory allocator to use in actually creating space.
uint64_t getSymbolAddress(const std::string &Name) override
uint8_t * allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, llvm::StringRef SectionName, bool IsReadOnly) override
Allocate space for data, and add it to the m_spaceBlocks map.
IRExecutionUnit & m_parent
The execution unit this is a proxy for.
~MemoryManager() override
uint64_t GetSymbolAddressAndPresence(const std::string &Name, bool &missing_weak)
llvm::JITSymbol findSymbol(const std::string &Name) override
uint8_t * allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, llvm::StringRef SectionName) override
Allocate space for executable code, and add it to the m_spaceBlocks map.
"lldb/Expression/IRExecutionUnit.h" Contains the IR and, optionally, JIT- compiled code for a module.
std::vector< std::string > m_cpu_features
void CollectCandidateCPlusPlusNames(std::vector< ConstString > &CPP_names, const std::vector< ConstString > &C_names, const SymbolContext &sc)
lldb::addr_t WriteNow(const uint8_t *bytes, size_t size, Status &error)
Accessors for IRForTarget and other clients that may want binary data placed on their behalf.
static const unsigned eSectionIDInvalid
void PopulateSymtab(lldb_private::ObjectFile *obj_file, lldb_private::Symtab &symtab) override
lldb::addr_t FindInSymbols(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc, bool &symbol_was_missing_weak)
void GetRunnableInfo(Status &error, lldb::addr_t &func_addr, lldb::addr_t &func_end)
lldb::ByteOrder GetByteOrder() const override
ObjectFileJITDelegate overrides.
SymbolContext m_sym_ctx
Used for symbol lookups.
std::vector< JittedFunction > m_jitted_functions
A vector of all functions that have been JITted into machine code.
Status DisassembleFunction(Stream &stream, lldb::ProcessSP &process_sp)
ConstString GetFunctionName()
std::vector< ConstString > m_failed_lookups
std::unique_ptr< llvm::Module > m_module_up
Holder for the module until it's been handed off.
lldb::addr_t FindSymbol(ConstString name, bool &missing_weak)
lldb::addr_t FindInRuntimes(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc)
static lldb::SectionType GetSectionTypeFromSectionName(const llvm::StringRef &name, AllocationKind alloc_kind)
uint32_t GetAddressByteSize() const override
bool CommitAllocations(lldb::ProcessSP &process_sp)
Commit all allocations to the process and record where they were stored.
bool CommitOneAllocation(lldb::ProcessSP &process_sp, Status &error, AllocationRecord &record)
void GetStaticInitializers(std::vector< lldb::addr_t > &static_initializers)
llvm::Module * GetModule()
void CollectCandidateCNames(std::vector< ConstString > &C_names, ConstString name)
std::unique_ptr< llvm::ExecutionEngine > m_execution_engine_up
llvm::Module * m_module
Owned by the execution engine.
std::unique_ptr< llvm::LLVMContext > m_context_up
ArchSpec GetArchitecture() override
lldb::addr_t m_function_load_addr
const std::vector< JittedGlobalVariable > & GetJittedGlobalVariables()
AddrRange GetRemoteRangeForLocal(lldb::addr_t local_address)
Look up the object in m_address_map that contains a given address, find where it was copied to,...
bool m_strip_underscore
True for platforms where global symbols have a _ prefix.
llvm::Function * GetFunction()
void ReportSymbolLookupError(ConstString name)
lldb::addr_t FindInUserDefinedSymbols(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc)
lldb::addr_t m_function_end_load_addr
void PopulateSectionList(lldb_private::ObjectFile *obj_file, lldb_private::SectionList §ion_list) override
std::vector< AllocationRecord > RecordVector
const std::vector< JittedFunction > & GetJittedFunctions()
std::pair< lldb::addr_t, uintptr_t > AddrRange
void FreeNow(lldb::addr_t allocation)
std::atomic< bool > m_did_jit
std::vector< JittedGlobalVariable > m_jitted_global_variables
A vector of all functions that have been JITted into machine code.
bool WriteData(lldb::ProcessSP &process_sp)
Write the contents of all allocations to the process.
std::unique_ptr< llvm::ObjectCache > m_object_cache_up
~IRExecutionUnit() override
Destructor.
lldb::ModuleSP GetJITModule()
void ReportAllocations(llvm::ExecutionEngine &engine)
Report all committed allocations to the execution engine.
lldb::addr_t GetRemoteAddressForLocal(lldb::addr_t local_address)
Look up the object in m_address_map that contains a given address, find where it was copied to,...
bool m_reported_allocations
True after allocations have been reported.
Encapsulates memory that may exist in the process but must also be available in the host process.
A plug-in interface definition class for object file parsers.
A stream class that can stream formatted output to a file.
Defines a symbol context baton that can be handed other debug core functions.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Process > ProcessSP
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::Module > ModuleSP
Encapsulates a single allocation request made by the JIT.
lldb::SectionType m_sect_type
AllocationRecord(uintptr_t host_address, uint32_t permissions, lldb::SectionType sect_type, size_t size, unsigned alignment, unsigned section_id, const char *name)
lldb::addr_t m_process_address
JittedEntity(const char *name, lldb::addr_t local_addr=LLDB_INVALID_ADDRESS, lldb::addr_t remote_addr=LLDB_INVALID_ADDRESS)
Constructor.
ConstString m_name
The function's name.
lldb::addr_t m_remote_addr
The address of the function in the target's memory.
lldb::addr_t m_local_addr
The address of the function in LLDB's memory.
"lldb/Expression/IRExecutionUnit.h" Encapsulates a single function that has been generated by the JIT...
JittedFunction(const char *name, bool external, lldb::addr_t local_addr=LLDB_INVALID_ADDRESS, lldb::addr_t remote_addr=LLDB_INVALID_ADDRESS)
JittedGlobalVariable(const char *name, lldb::addr_t local_addr=LLDB_INVALID_ADDRESS, lldb::addr_t remote_addr=LLDB_INVALID_ADDRESS)