Go to the documentation of this file.
9 #ifndef LLDB_EXPRESSION_IREXECUTIONUNIT_H
10 #define LLDB_EXPRESSION_IREXECUTIONUNIT_H
17 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
18 #include "llvm/IR/Module.h"
30 class ExecutionEngine;
62 std::unique_ptr<llvm::Module> &module_up,
ConstString &name,
63 const lldb::TargetSP &target_sp,
const SymbolContext &sym_ctx,
64 std::vector<std::string> &cpu_features);
213 bool WriteData(lldb::ProcessSP &process_sp);
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 {}
312 bool AbortOnFailure =
true)
override;
349 unsigned alignment,
unsigned section_id,
const char *name)
361 AllocationRecord &record);
369 std::unique_ptr<llvm::Module>
403 #endif // LLDB_EXPRESSION_IREXECUTIONUNIT_H
const std::vector< JittedFunction > & GetJittedFunctions()
lldb::addr_t FindInUserDefinedSymbols(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc)
std::vector< JittedGlobalVariable > m_jitted_global_variables
A vector of all functions that have been JITted into machine code.
JittedGlobalVariable(const char *name, lldb::addr_t local_addr=LLDB_INVALID_ADDRESS, lldb::addr_t remote_addr=LLDB_INVALID_ADDRESS)
void GetRunnableInfo(Status &error, lldb::addr_t &func_addr, lldb::addr_t &func_end)
uint32_t GetAddressByteSize() const override
bool m_strip_underscore
True for platforms where global symbols have a _ prefix.
void deregisterEHFrames() override
Status DisassembleFunction(Stream &stream, lldb::ProcessSP &process_sp)
ConstString GetFunctionName()
std::pair< lldb::addr_t, uintptr_t > AddrRange
~IRExecutionUnit() override
Destructor.
SymbolContext m_sym_ctx
Used for symbol lookups.
IRExecutionUnit & m_parent
The execution unit this is a proxy for.
bool WriteData(lldb::ProcessSP &process_sp)
Write the contents of all allocations to the process.
lldb::addr_t FindSymbol(ConstString name, bool &missing_weak)
llvm::Function * GetFunction()
lldb::addr_t FindInSymbols(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc, bool &symbol_was_missing_weak)
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.
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_local_addr
The address of the function in LLDB's memory.
void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) override
MemoryManager(IRExecutionUnit &parent)
static llvm::raw_ostream & error(Stream &strm)
std::vector< ConstString > m_failed_lookups
void PopulateSectionList(lldb_private::ObjectFile *obj_file, lldb_private::SectionList §ion_list) override
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,...
void CollectCandidateCNames(std::vector< ConstString > &C_names, ConstString name)
llvm::Module * m_module
Owned by the execution engine.
lldb::addr_t m_function_end_load_addr
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
bool m_reported_allocations
True after allocations have been reported.
JittedFunction(const char *name, bool external, lldb::addr_t local_addr=LLDB_INVALID_ADDRESS, lldb::addr_t remote_addr=LLDB_INVALID_ADDRESS)
IRExecutionUnit(std::unique_ptr< llvm::LLVMContext > &context_up, std::unique_ptr< llvm::Module > &module_up, ConstString &name, const lldb::TargetSP &target_sp, const SymbolContext &sym_ctx, std::vector< std::string > &cpu_features)
Constructor.
llvm::JITSymbol findSymbol(const std::string &Name) override
llvm::Module * GetModule()
static const unsigned eSectionIDInvalid
void * getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure=true) override
string(SUBSTRING ${p} 10 -1 pStripped) if($
~MemoryManager() override
static lldb::SectionType GetSectionTypeFromSectionName(const llvm::StringRef &name, AllocationKind alloc_kind)
std::atomic< bool > m_did_jit
void PopulateSymtab(lldb_private::ObjectFile *obj_file, lldb_private::Symtab &symtab) override
void ReportSymbolLookupError(ConstString name)
bool CommitAllocations(lldb::ProcessSP &process_sp)
Commit all allocations to the process and record where they were stored.
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.
std::vector< std::string > m_cpu_features
std::unique_ptr< llvm::Module > m_module_up
Holder for the module until it's been handed off.
bool finalizeMemory(std::string *ErrMsg) override
Called when object loading is complete and section page permissions can be applied.
void GetStaticInitializers(std::vector< lldb::addr_t > &static_initializers)
const std::vector< JittedGlobalVariable > & GetJittedGlobalVariables()
Encapsulates a single allocation request made by the JIT.
void FreeNow(lldb::addr_t allocation)
lldb::addr_t m_process_address
std::vector< JittedFunction > m_jitted_functions
A vector of all functions that have been JITted into machine code.
void CollectCandidateCPlusPlusNames(std::vector< ConstString > &CPP_names, const std::vector< ConstString > &C_names, const SymbolContext &sc)
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,...
std::unique_ptr< llvm::LLVMContext > m_context_up
std::unique_ptr< SectionMemoryManager > m_default_mm_up
The memory allocator to use in actually creating space.
lldb::addr_t m_function_load_addr
lldb::addr_t m_remote_addr
The address of the function in the target's memory.
#define LLDB_INVALID_ADDRESS
lldb::SectionType m_sect_type
lldb::ByteOrder GetByteOrder() const override
ObjectFileJITDelegate overrides.
std::vector< AllocationRecord > RecordVector
ArchSpec GetArchitecture() override
lldb::addr_t FindInRuntimes(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc)
A class that represents a running process on the host machine.
uint64_t GetSymbolAddressAndPresence(const std::string &Name, bool &missing_weak)
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.
JittedEntity(const char *name, lldb::addr_t local_addr=LLDB_INVALID_ADDRESS, lldb::addr_t remote_addr=LLDB_INVALID_ADDRESS)
Constructor.
std::unique_ptr< llvm::ExecutionEngine > m_execution_engine_up
uint64_t getSymbolAddress(const std::string &Name) override
lldb::ModuleSP GetJITModule()
ConstString m_name
The function's name.
std::unique_ptr< llvm::ObjectCache > m_object_cache_up
ByteOrder
Byte ordering definitions.
bool CommitOneAllocation(lldb::ProcessSP &process_sp, Status &error, AllocationRecord &record)