9#include "llvm/ExecutionEngine/ExecutionEngine.h"
10#include "llvm/ExecutionEngine/ObjectCache.h"
11#include "llvm/IR/Constants.h"
12#include "llvm/IR/DiagnosticHandler.h"
13#include "llvm/IR/DiagnosticInfo.h"
14#include "llvm/IR/LLVMContext.h"
15#include "llvm/IR/Module.h"
16#include "llvm/Support/SourceMgr.h"
17#include "llvm/Support/raw_ostream.h"
45 std::unique_ptr<llvm::Module> &module_up,
49 std::vector<std::string> &cpu_features)
50 :
IRMemoryMap(target_sp), m_context_up(context_up.release()),
51 m_module_up(module_up.release()), m_module(m_module_up.get()),
52 m_cpu_features(cpu_features), m_name(name), m_sym_ctx(sym_ctx),
55 m_reported_allocations(false) {}
59 const bool zero_memory =
false;
61 Malloc(size, 8, lldb::ePermissionsWritable | lldb::ePermissionsReadable,
69 if (!
error.Success()) {
71 Free(allocation_process_addr, err);
85 allocation_process_addr, 16,
90 return allocation_process_addr;
99 Free(allocation, err);
116 if (function.m_name ==
m_name) {
117 func_local_addr = function.m_local_addr;
118 func_remote_addr = function.m_remote_addr;
130 "Found function, has local address 0x%" PRIx64
131 " and remote address 0x%" PRIx64,
132 (uint64_t)func_local_addr, (uint64_t)func_remote_addr);
134 std::pair<lldb::addr_t, lldb::addr_t> func_range;
138 if (func_range.first == 0 && func_range.second == 0) {
145 LLDB_LOGF(log,
"Function's code range is [0x%" PRIx64
"+0x%" PRIx64
"]",
146 func_range.first, func_range.second);
160 process->
ReadMemory(func_remote_addr, buffer_sp->GetBytes(),
161 buffer_sp->GetByteSize(), err);
172 const char *plugin_name =
nullptr;
173 const char *flavor_string =
nullptr;
177 if (!disassembler_sp) {
180 "Unable to find disassembler plug-in for %s architecture.",
195 LLDB_LOGF(log,
"Function data has contents:");
200 disassembler_sp->DecodeInstructions(
Address(func_remote_addr), extractor, 0,
203 InstructionList &instruction_list = disassembler_sp->GetInstructionList();
204 instruction_list.
Dump(&stream,
true,
true,
false,
211struct IRExecDiagnosticHandler :
public llvm::DiagnosticHandler {
213 IRExecDiagnosticHandler(
Status *err) : err(err) {}
214 bool handleDiagnostics(
const llvm::DiagnosticInfo &DI)
override {
215 if (DI.getSeverity() == llvm::DS_Error) {
216 const auto &DISM = llvm::cast<llvm::DiagnosticInfoSrcMgr>(DI);
220 "IRExecution error: %s",
221 DISM.getSMDiag().getMessage().str().c_str());
238 static std::recursive_mutex s_runnable_info_mutex;
244 error.SetErrorToGenericError();
245 error.SetErrorString(
"Couldn't write the JIT compiled code into the "
246 "process because the process is invalid");
257 std::lock_guard<std::recursive_mutex> guard(s_runnable_info_mutex);
263 std::string error_string;
267 llvm::raw_string_ostream oss(s);
273 LLDB_LOGF(log,
"Module being sent to JIT: \n%s", s.c_str());
277 std::make_unique<IRExecDiagnosticHandler>(&
error));
279 llvm::EngineBuilder builder(std::move(
m_module_up));
280 llvm::Triple triple(
m_module->getTargetTriple());
282 builder.setEngineKind(llvm::EngineKind::JIT)
283 .setErrorStr(&error_string)
284 .setRelocationModel(triple.isOSBinFormatMachO() ? llvm::Reloc::PIC_
285 : llvm::Reloc::Static)
286 .setMCJITMemoryManager(std::make_unique<MemoryManager>(*
this))
287 .setOptLevel(llvm::CodeGenOptLevel::Less);
289 llvm::StringRef mArch;
290 llvm::StringRef mCPU;
291 llvm::SmallVector<std::string, 0> mAttrs;
294 mAttrs.push_back(feature);
296 llvm::TargetMachine *target_machine =
297 builder.selectTarget(triple, mArch, mCPU, mAttrs);
302 error.SetErrorToGenericError();
303 error.SetErrorStringWithFormat(
"Couldn't JIT the function: %s",
304 error_string.c_str());
311 class ObjectDumper :
public llvm::ObjectCache {
313 ObjectDumper(
FileSpec output_dir) : m_out_dir(output_dir) {}
314 void notifyObjectCompiled(
const llvm::Module *module,
315 llvm::MemoryBufferRef
object)
override {
317 llvm::SmallVector<char, 256> result_path;
318 std::string object_name_model =
319 "jit-object-" + module->getModuleIdentifier() +
"-%%%.o";
322 std::string model_path = model_spec.
GetPath();
324 std::error_code result
325 = llvm::sys::fs::createUniqueFile(model_path, fd, result_path);
327 llvm::raw_fd_ostream fds(fd,
true);
328 fds.write(
object.getBufferStart(),
object.getBufferSize());
331 std::unique_ptr<llvm::MemoryBuffer>
332 getObject(
const llvm::Module *module)
override {
341 FileSpec save_objects_dir = process_sp->GetTarget().GetSaveJITObjectsDir();
342 if (save_objects_dir) {
353 for (llvm::Function &function : *
m_module) {
354 if (function.isDeclaration() || function.hasPrivateLinkage())
357 const bool external = !function.hasLocalLinkage();
361 if (!
error.Success()) {
367 error.SetErrorToGenericError();
368 error.SetErrorStringWithFormat(
369 "'%s' was in the JITted module but wasn't lowered",
370 function.getName().str().c_str());
374 function.getName().str().c_str(), external,
reinterpret_cast<uintptr_t
>(fun_ptr)));
386 std::function<void(llvm::GlobalValue &)> RegisterOneValue = [
this](
387 llvm::GlobalValue &val) {
388 if (val.hasExternalLinkage() && !val.isDeclaration()) {
389 uint64_t var_ptr_addr =
399 remote_addr = var_ptr_addr;
402 if (var_ptr_addr != 0)
408 for (llvm::GlobalVariable &global_var :
m_module->globals()) {
409 RegisterOneValue(global_var);
412 for (llvm::GlobalAlias &global_alias :
m_module->aliases()) {
413 RegisterOneValue(global_alias);
423 bool emitNewLine =
false;
444 jitted_function.m_remote_addr =
456 LLDB_LOGF(log,
"Code can be run in the target.");
463 LLDB_LOGF(log,
"Couldn't disassemble function : %s",
484 record.m_process_address, 16,
490 DataExtractor my_extractor((
const void *)record.m_host_address,
492 my_extractor.
PutToLog(log, 0, record.m_size, record.m_host_address, 16,
509 : m_default_mm_up(new
llvm::SectionMemoryManager()), m_parent(parent) {}
516 switch (alloc_kind) {
535 if (name.equals(
"__text") || name.equals(
".text"))
537 else if (name.equals(
"__data") || name.equals(
".data"))
539 else if (name.starts_with(
"__debug_") || name.starts_with(
".debug_")) {
540 const uint32_t name_idx = name[0] ==
'_' ? 8 : 7;
541 llvm::StringRef dwarf_name(name.substr(name_idx));
542 switch (dwarf_name[0]) {
544 if (dwarf_name.equals(
"abbrev"))
546 else if (dwarf_name.equals(
"aranges"))
548 else if (dwarf_name.equals(
"addr"))
553 if (dwarf_name.equals(
"frame"))
558 if (dwarf_name.equals(
"info"))
563 if (dwarf_name.equals(
"line"))
565 else if (dwarf_name.equals(
"loc"))
567 else if (dwarf_name.equals(
"loclists"))
572 if (dwarf_name.equals(
"macinfo"))
577 if (dwarf_name.equals(
"pubnames"))
579 else if (dwarf_name.equals(
"pubtypes"))
584 if (dwarf_name.equals(
"str"))
586 else if (dwarf_name.equals(
"str_offsets"))
591 if (dwarf_name.equals(
"ranges"))
598 }
else if (name.starts_with(
"__apple_") || name.starts_with(
".apple_"))
600 else if (name.equals(
"__objc_imageinfo"))
607 uintptr_t Size,
unsigned Alignment,
unsigned SectionID,
608 llvm::StringRef SectionName) {
611 uint8_t *return_value = m_default_mm_up->allocateCodeSection(
612 Size, Alignment, SectionID, SectionName);
615 (uintptr_t)return_value,
616 lldb::ePermissionsReadable | lldb::ePermissionsExecutable,
618 Alignment, SectionID, SectionName.str().c_str()));
621 "IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64
622 ", Alignment=%u, SectionID=%u) = %p",
623 (uint64_t)Size, Alignment, SectionID, (
void *)return_value);
625 if (m_parent.m_reported_allocations) {
628 m_parent.GetBestExecutionContextScope()->CalculateProcess();
630 m_parent.CommitOneAllocation(process_sp, err, m_parent.m_records.back());
637 uintptr_t Size,
unsigned Alignment,
unsigned SectionID,
638 llvm::StringRef SectionName,
bool IsReadOnly) {
641 uint8_t *return_value = m_default_mm_up->allocateDataSection(
642 Size, Alignment, SectionID, SectionName, IsReadOnly);
644 uint32_t permissions = lldb::ePermissionsReadable;
646 permissions |= lldb::ePermissionsWritable;
648 (uintptr_t)return_value, permissions,
650 Alignment, SectionID, SectionName.str().c_str()));
652 "IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64
653 ", Alignment=%u, SectionID=%u) = %p",
654 (uint64_t)Size, Alignment, SectionID, (
void *)return_value);
656 if (m_parent.m_reported_allocations) {
659 m_parent.GetBestExecutionContextScope()->CalculateProcess();
661 m_parent.CommitOneAllocation(process_sp, err, m_parent.m_records.back());
671 C_names.push_back(name);
675 std::vector<ConstString> &CPP_names,
676 const std::vector<ConstString> &C_names,
const SymbolContext &sc) {
680 if (cpp_lang->SymbolNameFitsToLanguage(mangled)) {
682 cpp_lang->FindBestAlternateFunctionMangledName(mangled, sc)) {
683 CPP_names.push_back(best_alternate);
687 std::vector<ConstString> alternates =
688 cpp_lang->GenerateAlternateFunctionManglings(name);
689 CPP_names.insert(CPP_names.end(), alternates.begin(), alternates.end());
694 cpp_lang->GetDemangledFunctionNameWithoutArguments(mangled);
695 CPP_names.push_back(basename);
703 : m_target(target), m_symbol_was_missing_weak(symbol_was_missing_weak) {}
713 m_symbol_was_missing_weak =
true;
717 if (!candidate_sc.symbol ||
719 !candidate_sc.symbol->IsWeak())
720 m_symbol_was_missing_weak =
false;
723 if (candidate_sc.symbol) {
724 load_address = candidate_sc.symbol->ResolveCallableAddress(*m_target);
726 Address addr = candidate_sc.symbol->GetAddress();
727 load_address = m_target->GetProcessSP()
736 candidate_sc.function->GetAddressRange().GetBaseAddress();
737 load_address = m_target->GetProcessSP() ? addr.
GetLoadAddress(m_target)
744 const bool is_external =
745 (candidate_sc.function) ||
746 (candidate_sc.symbol && candidate_sc.symbol->IsExternal());
752 m_best_internal_load_address = load_address;
758 if (m_symbol_was_missing_weak)
765 return m_best_internal_load_address;
777 bool &symbol_was_missing_weak) {
778 symbol_was_missing_weak =
false;
796 lldb::eFunctionNameTypeFull, function_options,
798 if (
auto load_addr = resolver.
Resolve(sc_list))
804 sc.
target_sp->GetImages().FindFunctions(name, lldb::eFunctionNameTypeFull,
805 function_options, sc_list);
806 if (
auto load_addr = resolver.
Resolve(sc_list))
812 sc.
target_sp->GetImages().FindSymbolsWithNameAndType(
814 if (
auto load_addr = resolver.
Resolve(sc_list))
821 return best_internal_load_address;
844 lldb::addr_t symbol_load_addr = runtime->LookupRuntimeSymbol(name);
847 return symbol_load_addr;
855 const std::vector<ConstString> &names,
860 lldb::addr_t symbol_load_addr = target_sp->GetPersistentSymbol(name);
863 return symbol_load_addr;
870 bool &missing_weak) {
871 std::vector<ConstString> candidate_C_names;
872 std::vector<ConstString> candidate_CPlusPlus_names;
882 missing_weak =
false;
898 std::vector<lldb::addr_t> &static_initializers) {
901 llvm::GlobalVariable *global_ctors =
902 m_module->getNamedGlobal(
"llvm.global_ctors");
904 LLDB_LOG(log,
"Couldn't find llvm.global_ctors.");
908 llvm::dyn_cast<llvm::ConstantArray>(global_ctors->getInitializer());
910 LLDB_LOG(log,
"llvm.global_ctors not a ConstantArray.");
914 for (llvm::Use &ctor_use : ctor_array->operands()) {
915 auto *ctor_struct = llvm::dyn_cast<llvm::ConstantStruct>(ctor_use);
919 lldbassert(ctor_struct->getNumOperands() == 3);
920 auto *ctor_function =
921 llvm::dyn_cast<llvm::Function>(ctor_struct->getOperand(1));
922 if (!ctor_function) {
923 LLDB_LOG(log,
"global_ctor doesn't contain an llvm::Function");
927 ConstString ctor_function_name(ctor_function->getName().str());
928 LLDB_LOG(log,
"Looking for callable jitted function with name {0}.",
932 if (ctor_function_name != jitted_function.m_name)
935 LLDB_LOG(log,
"Found jitted function with invalid address.");
938 static_initializers.push_back(jitted_function.m_remote_addr);
939 LLDB_LOG(log,
"Calling function at address {0:x}.",
940 jitted_function.m_remote_addr);
948 bool missing_weak =
false;
949 uint64_t addr = GetSymbolAddressAndPresence(Name, missing_weak);
952 return llvm::JITSymbol(addr,
953 llvm::JITSymbolFlags::Exported | llvm::JITSymbolFlags::Weak);
955 return llvm::JITSymbol(addr, llvm::JITSymbolFlags::Exported);
960 bool missing_weak =
false;
961 return GetSymbolAddressAndPresence(Name, missing_weak);
966 const std::string &Name,
bool &missing_weak) {
971 lldb::addr_t ret = m_parent.FindSymbol(name_cs, missing_weak);
975 "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>",
978 m_parent.ReportSymbolLookupError(name_cs);
981 LLDB_LOGF(log,
"IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64,
988 const std::string &Name,
bool AbortOnFailure) {
989 return (
void *)getSymbolAddress(Name);
997 if (local_address >= record.m_host_address &&
998 local_address < record.m_host_address + record.m_size) {
1003 record.m_process_address + (local_address - record.m_host_address);
1006 "IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64
1007 " in [0x%" PRIx64
"..0x%" PRIx64
"], and returned 0x%" PRIx64
1008 " from [0x%" PRIx64
"..0x%" PRIx64
"].",
1009 local_address, (uint64_t)record.m_host_address,
1010 (uint64_t)record.m_host_address + (uint64_t)record.m_size, ret,
1011 record.m_process_address,
1012 record.m_process_address + record.m_size);
1024 if (local_address >= record.m_host_address &&
1025 local_address < record.m_host_address + record.m_size) {
1029 return AddrRange(record.m_process_address, record.m_size);
1068 const bool zero_memory =
false;
1075 return error.Success();
1094 Free(record.m_process_address, err);
1113 engine.mapSectionAddress((
void *)record.m_host_address,
1114 record.m_process_address);
1118 engine.finalizeObject();
1122 bool wrote_something =
false;
1126 WriteMemory(record.m_process_address, (uint8_t *)record.m_host_address,
1127 record.m_size, err);
1129 wrote_something =
true;
1132 return wrote_something;
1140 "[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)",
1141 (
unsigned long long)m_host_address, (
unsigned long long)m_size,
1142 (
unsigned long long)m_process_address, (
unsigned)m_alignment,
1143 (
unsigned)m_section_id,
m_name.c_str());
1165 if (record.m_size > 0) {
1167 obj_file->
GetModule(), obj_file, record.m_section_id,
1169 record.m_process_address, record.m_size,
1170 record.m_host_address,
1174 record.m_permissions));
1183 return target->GetArchitecture();
1193 auto Delegate = std::static_pointer_cast<lldb_private::ObjectFileJITDelegate>(
1194 shared_from_this());
1197 lldb_private::Module::CreateModuleFromObjectFile<ObjectFileJIT>(Delegate);
1201 bool changed =
false;
1202 jit_module_sp->SetLoadAddress(*target, 0,
true, changed);
1203 return jit_module_sp;
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
LoadAddressResolver(Target *target, bool &symbol_was_missing_weak)
bool & m_symbol_was_missing_weak
std::optional< lldb::addr_t > Resolve(SymbolContextList &sc_list)
lldb::addr_t GetBestInternalLoadAddress() const
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
lldb::addr_t GetFileAddress() const
Get the file address.
An architecture specification class.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Represents a generic declaration context in a program.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
bool IsEmpty() const
Test for empty string.
A subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
uint32_t GetAddressByteSize() const
lldb::ByteOrder GetByteOrder() const
Target * GetTargetPtr() const
Returns a pointer to the target object.
Process * GetProcessPtr() const
Returns a pointer to the process object.
FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
void * getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure=true) override
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.
~MemoryManager() override
uint64_t GetSymbolAddressAndPresence(const std::string &Name, bool &missing_weak)
llvm::JITSymbol findSymbol(const std::string &Name) override
MemoryManager(IRExecutionUnit &parent)
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)
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)
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.
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)
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
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.
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::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.
void Free(lldb::addr_t process_address, Status &error)
ExecutionContextScope * GetBestExecutionContextScope() const
lldb::addr_t Malloc(size_t size, uint8_t alignment, uint32_t permissions, AllocationPolicy policy, bool zero_memory, Status &error)
lldb::ProcessWP & GetProcessWP()
void WriteMemory(lldb::addr_t process_address, const uint8_t *bytes, size_t size, Status &error)
void ReadMemory(uint8_t *bytes, lldb::addr_t process_address, size_t size, Status &error)
@ eAllocationPolicyProcessOnly
The intent is that this allocation exist only in the process.
@ eAllocationPolicyMirror
The intent is that this allocation exist both in the host and the process and have the same content i...
void Dump(Stream *s, bool show_address, bool show_bytes, bool show_control_flow_kind, const ExecutionContext *exe_ctx)
static Language * FindPlugin(lldb::LanguageType language)
A class that handles mangled names.
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
A plug-in interface definition class for object file parsers.
A plug-in interface definition class for debugging a process.
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
lldb::ByteOrder GetByteOrder() const
size_t AddSection(const lldb::SectionSP §ion_sp)
void Clear()
Clear the object state.
void SetErrorToGenericError()
Set the current error to a generic error.
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
bool Success() const
Test for success condition.
const char * GetData() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Defines a list of symbol context objects.
SymbolContextIterable SymbolContexts()
Defines a symbol context baton that can be handed other debug core functions.
lldb::ModuleSP module_sp
The Module for a given query.
lldb::TargetSP target_sp
The Target for a given query.
const ArchSpec & GetArchitecture() const
uint8_t * GetBytes()
Get a pointer to the data.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Disassembler > DisassemblerSP
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::Section > SectionSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
std::shared_ptr< lldb_private::Target > TargetSP
@ eSectionTypeDWARFDebugStrOffsets
@ eSectionTypeDWARFDebugPubNames
@ eSectionTypeDWARFDebugFrame
@ eSectionTypeDWARFDebugLocLists
DWARF v5 .debug_loclists.
@ eSectionTypeDWARFDebugMacInfo
@ eSectionTypeDWARFAppleNamespaces
@ eSectionTypeDWARFAppleTypes
@ eSectionTypeDWARFDebugInfo
@ eSectionTypeDWARFDebugRanges
@ eSectionTypeDWARFDebugLine
@ eSectionTypeDWARFDebugPubTypes
@ eSectionTypeDWARFDebugStr
@ eSectionTypeDWARFDebugLoc
@ eSectionTypeDWARFAppleNames
@ eSectionTypeDWARFAppleObjC
@ eSectionTypeDWARFDebugCuIndex
@ eSectionTypeDWARFDebugAranges
@ eSectionTypeDWARFGNUDebugAltLink
@ eSectionTypeDWARFDebugAbbrev
@ eSectionTypeDWARFDebugAddr
std::shared_ptr< lldb_private::Module > ModuleSP
Encapsulates a single allocation request made by the JIT.
lldb::SectionType m_sect_type
lldb::addr_t m_process_address
"lldb/Expression/IRExecutionUnit.h" Encapsulates a single function that has been generated by the JIT...
Options used by Module::FindFunctions.
bool include_inlines
Include inlined functions.
bool include_symbols
Include the symbol table.