#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/ObjectCache.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DiagnosticHandler.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
#include "lldb/Expression/IRExecutionUnit.h"
#include "lldb/Expression/ObjectFileJIT.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include <optional>
usingnamespacelldb_private;
IRExecutionUnit::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)
: … { … }
lldb::addr_t IRExecutionUnit::WriteNow(const uint8_t *bytes, size_t size,
Status &error) { … }
void IRExecutionUnit::FreeNow(lldb::addr_t allocation) { … }
Status IRExecutionUnit::DisassembleFunction(Stream &stream,
lldb::ProcessSP &process_wp) { … }
namespace {
struct IRExecDiagnosticHandler : public llvm::DiagnosticHandler { … };
}
void IRExecutionUnit::ReportSymbolLookupError(ConstString name) { … }
void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
lldb::addr_t &func_end) { … }
IRExecutionUnit::~IRExecutionUnit() { … }
IRExecutionUnit::MemoryManager::MemoryManager(IRExecutionUnit &parent)
: … { … }
IRExecutionUnit::MemoryManager::~MemoryManager() = default;
lldb::SectionType IRExecutionUnit::GetSectionTypeFromSectionName(
const llvm::StringRef &name, IRExecutionUnit::AllocationKind alloc_kind) { … }
uint8_t *IRExecutionUnit::MemoryManager::allocateCodeSection(
uintptr_t Size, unsigned Alignment, unsigned SectionID,
llvm::StringRef SectionName) { … }
uint8_t *IRExecutionUnit::MemoryManager::allocateDataSection(
uintptr_t Size, unsigned Alignment, unsigned SectionID,
llvm::StringRef SectionName, bool IsReadOnly) { … }
void IRExecutionUnit::CollectCandidateCNames(std::vector<ConstString> &C_names,
ConstString name) { … }
void IRExecutionUnit::CollectCandidateCPlusPlusNames(
std::vector<ConstString> &CPP_names,
const std::vector<ConstString> &C_names, const SymbolContext &sc) { … }
class LoadAddressResolver { … };
lldb::addr_t
IRExecutionUnit::FindInSymbols(const std::vector<ConstString> &names,
const lldb_private::SymbolContext &sc,
bool &symbol_was_missing_weak) { … }
lldb::addr_t
IRExecutionUnit::FindInRuntimes(const std::vector<ConstString> &names,
const lldb_private::SymbolContext &sc) { … }
lldb::addr_t IRExecutionUnit::FindInUserDefinedSymbols(
const std::vector<ConstString> &names,
const lldb_private::SymbolContext &sc) { … }
lldb::addr_t IRExecutionUnit::FindSymbol(lldb_private::ConstString name,
bool &missing_weak) { … }
void IRExecutionUnit::GetStaticInitializers(
std::vector<lldb::addr_t> &static_initializers) { … }
llvm::JITSymbol
IRExecutionUnit::MemoryManager::findSymbol(const std::string &Name) { … }
uint64_t
IRExecutionUnit::MemoryManager::getSymbolAddress(const std::string &Name) { … }
uint64_t
IRExecutionUnit::MemoryManager::GetSymbolAddressAndPresence(
const std::string &Name, bool &missing_weak) { … }
void *IRExecutionUnit::MemoryManager::getPointerToNamedFunction(
const std::string &Name, bool AbortOnFailure) { … }
lldb::addr_t
IRExecutionUnit::GetRemoteAddressForLocal(lldb::addr_t local_address) { … }
IRExecutionUnit::AddrRange
IRExecutionUnit::GetRemoteRangeForLocal(lldb::addr_t local_address) { … }
bool IRExecutionUnit::CommitOneAllocation(lldb::ProcessSP &process_sp,
Status &error,
AllocationRecord &record) { … }
bool IRExecutionUnit::CommitAllocations(lldb::ProcessSP &process_sp) { … }
void IRExecutionUnit::ReportAllocations(llvm::ExecutionEngine &engine) { … }
bool IRExecutionUnit::WriteData(lldb::ProcessSP &process_sp) { … }
void IRExecutionUnit::AllocationRecord::dump(Log *log) { … }
lldb::ByteOrder IRExecutionUnit::GetByteOrder() const { … }
uint32_t IRExecutionUnit::GetAddressByteSize() const { … }
void IRExecutionUnit::PopulateSymtab(lldb_private::ObjectFile *obj_file,
lldb_private::Symtab &symtab) { … }
void IRExecutionUnit::PopulateSectionList(
lldb_private::ObjectFile *obj_file,
lldb_private::SectionList §ion_list) { … }
ArchSpec IRExecutionUnit::GetArchitecture() { … }
lldb::ModuleSP IRExecutionUnit::GetJITModule() { … }