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;
435 "\nHint: The expression tried to call a function that is not present "
436 "in the target, perhaps because it was optimized out by the compiler.");
446 jitted_function.m_remote_addr =
458 LLDB_LOGF(log,
"Code can be run in the target.");
465 LLDB_LOGF(log,
"Couldn't disassemble function : %s",
486 record.m_process_address, 16,
492 DataExtractor my_extractor((
const void *)record.m_host_address,
494 my_extractor.
PutToLog(log, 0, record.m_size, record.m_host_address, 16,
511 : m_default_mm_up(new
llvm::SectionMemoryManager()), m_parent(parent) {}
518 switch (alloc_kind) {
537 if (name ==
"__text" || name ==
".text")
539 else if (name ==
"__data" || name ==
".data")
541 else if (name.starts_with(
"__debug_") || name.starts_with(
".debug_")) {
542 const uint32_t name_idx = name[0] ==
'_' ? 8 : 7;
543 llvm::StringRef dwarf_name(name.substr(name_idx));
544 switch (dwarf_name[0]) {
546 if (dwarf_name ==
"abbrev")
548 else if (dwarf_name ==
"aranges")
550 else if (dwarf_name ==
"addr")
555 if (dwarf_name ==
"frame")
560 if (dwarf_name ==
"info")
565 if (dwarf_name ==
"line")
567 else if (dwarf_name ==
"loc")
569 else if (dwarf_name ==
"loclists")
574 if (dwarf_name ==
"macinfo")
579 if (dwarf_name ==
"pubnames")
581 else if (dwarf_name ==
"pubtypes")
586 if (dwarf_name ==
"str")
588 else if (dwarf_name ==
"str_offsets")
593 if (dwarf_name ==
"ranges")
600 }
else if (name.starts_with(
"__apple_") || name.starts_with(
".apple_"))
602 else if (name ==
"__objc_imageinfo")
609 uintptr_t Size,
unsigned Alignment,
unsigned SectionID,
610 llvm::StringRef SectionName) {
613 uint8_t *return_value = m_default_mm_up->allocateCodeSection(
614 Size, Alignment, SectionID, SectionName);
617 (uintptr_t)return_value,
618 lldb::ePermissionsReadable | lldb::ePermissionsExecutable,
620 Alignment, SectionID, SectionName.str().c_str()));
623 "IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64
624 ", Alignment=%u, SectionID=%u) = %p",
625 (uint64_t)Size, Alignment, SectionID, (
void *)return_value);
627 if (m_parent.m_reported_allocations) {
630 m_parent.GetBestExecutionContextScope()->CalculateProcess();
632 m_parent.CommitOneAllocation(process_sp, err, m_parent.m_records.back());
639 uintptr_t Size,
unsigned Alignment,
unsigned SectionID,
640 llvm::StringRef SectionName,
bool IsReadOnly) {
643 uint8_t *return_value = m_default_mm_up->allocateDataSection(
644 Size, Alignment, SectionID, SectionName, IsReadOnly);
646 uint32_t permissions = lldb::ePermissionsReadable;
648 permissions |= lldb::ePermissionsWritable;
650 (uintptr_t)return_value, permissions,
652 Alignment, SectionID, SectionName.str().c_str()));
654 "IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64
655 ", Alignment=%u, SectionID=%u) = %p",
656 (uint64_t)Size, Alignment, SectionID, (
void *)return_value);
658 if (m_parent.m_reported_allocations) {
661 m_parent.GetBestExecutionContextScope()->CalculateProcess();
663 m_parent.CommitOneAllocation(process_sp, err, m_parent.m_records.back());
673 C_names.push_back(name);
677 std::vector<ConstString> &CPP_names,
678 const std::vector<ConstString> &C_names,
const SymbolContext &sc) {
682 if (cpp_lang->SymbolNameFitsToLanguage(mangled)) {
684 cpp_lang->FindBestAlternateFunctionMangledName(mangled, sc)) {
685 CPP_names.push_back(best_alternate);
689 std::vector<ConstString> alternates =
690 cpp_lang->GenerateAlternateFunctionManglings(name);
691 CPP_names.insert(CPP_names.end(), alternates.begin(), alternates.end());
696 cpp_lang->GetDemangledFunctionNameWithoutArguments(mangled);
697 CPP_names.push_back(basename);
705 : m_target(target), m_symbol_was_missing_weak(symbol_was_missing_weak) {}
715 m_symbol_was_missing_weak =
true;
719 if (!candidate_sc.symbol ||
721 !candidate_sc.symbol->IsWeak())
722 m_symbol_was_missing_weak =
false;
725 if (candidate_sc.symbol) {
726 load_address = candidate_sc.symbol->ResolveCallableAddress(*m_target);
728 Address addr = candidate_sc.symbol->GetAddress();
729 load_address = m_target->GetProcessSP()
738 candidate_sc.function->GetAddressRange().GetBaseAddress();
739 load_address = m_target->GetProcessSP() ? addr.
GetLoadAddress(m_target)
746 const bool is_external =
747 (candidate_sc.function) ||
748 (candidate_sc.symbol && candidate_sc.symbol->IsExternal());
754 m_best_internal_load_address = load_address;
760 if (m_symbol_was_missing_weak)
767 return m_best_internal_load_address;
779 bool &symbol_was_missing_weak) {
780 symbol_was_missing_weak =
false;
798 lldb::eFunctionNameTypeFull, function_options,
800 if (
auto load_addr = resolver.
Resolve(sc_list))
806 sc.
target_sp->GetImages().FindFunctions(name, lldb::eFunctionNameTypeFull,
807 function_options, sc_list);
808 if (
auto load_addr = resolver.
Resolve(sc_list))
814 sc.
target_sp->GetImages().FindSymbolsWithNameAndType(
816 if (
auto load_addr = resolver.
Resolve(sc_list))
823 return best_internal_load_address;
846 lldb::addr_t symbol_load_addr = runtime->LookupRuntimeSymbol(name);
849 return symbol_load_addr;
857 const std::vector<ConstString> &names,
862 lldb::addr_t symbol_load_addr = target_sp->GetPersistentSymbol(name);
865 return symbol_load_addr;
872 bool &missing_weak) {
873 std::vector<ConstString> candidate_C_names;
874 std::vector<ConstString> candidate_CPlusPlus_names;
884 missing_weak =
false;
900 std::vector<lldb::addr_t> &static_initializers) {
903 llvm::GlobalVariable *global_ctors =
904 m_module->getNamedGlobal(
"llvm.global_ctors");
906 LLDB_LOG(log,
"Couldn't find llvm.global_ctors.");
910 llvm::dyn_cast<llvm::ConstantArray>(global_ctors->getInitializer());
912 LLDB_LOG(log,
"llvm.global_ctors not a ConstantArray.");
916 for (llvm::Use &ctor_use : ctor_array->operands()) {
917 auto *ctor_struct = llvm::dyn_cast<llvm::ConstantStruct>(ctor_use);
921 lldbassert(ctor_struct->getNumOperands() == 3);
922 auto *ctor_function =
923 llvm::dyn_cast<llvm::Function>(ctor_struct->getOperand(1));
924 if (!ctor_function) {
925 LLDB_LOG(log,
"global_ctor doesn't contain an llvm::Function");
929 ConstString ctor_function_name(ctor_function->getName().str());
930 LLDB_LOG(log,
"Looking for callable jitted function with name {0}.",
934 if (ctor_function_name != jitted_function.m_name)
937 LLDB_LOG(log,
"Found jitted function with invalid address.");
940 static_initializers.push_back(jitted_function.m_remote_addr);
941 LLDB_LOG(log,
"Calling function at address {0:x}.",
942 jitted_function.m_remote_addr);
950 bool missing_weak =
false;
951 uint64_t addr = GetSymbolAddressAndPresence(Name, missing_weak);
954 return llvm::JITSymbol(addr,
955 llvm::JITSymbolFlags::Exported | llvm::JITSymbolFlags::Weak);
957 return llvm::JITSymbol(addr, llvm::JITSymbolFlags::Exported);
962 bool missing_weak =
false;
963 return GetSymbolAddressAndPresence(Name, missing_weak);
968 const std::string &Name,
bool &missing_weak) {
973 lldb::addr_t ret = m_parent.FindSymbol(name_cs, missing_weak);
977 "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>",
980 m_parent.ReportSymbolLookupError(name_cs);
983 LLDB_LOGF(log,
"IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64,
990 const std::string &Name,
bool AbortOnFailure) {
991 return (
void *)getSymbolAddress(Name);
999 if (local_address >= record.m_host_address &&
1000 local_address < record.m_host_address + record.m_size) {
1005 record.m_process_address + (local_address - record.m_host_address);
1008 "IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64
1009 " in [0x%" PRIx64
"..0x%" PRIx64
"], and returned 0x%" PRIx64
1010 " from [0x%" PRIx64
"..0x%" PRIx64
"].",
1011 local_address, (uint64_t)record.m_host_address,
1012 (uint64_t)record.m_host_address + (uint64_t)record.m_size, ret,
1013 record.m_process_address,
1014 record.m_process_address + record.m_size);
1026 if (local_address >= record.m_host_address &&
1027 local_address < record.m_host_address + record.m_size) {
1031 return AddrRange(record.m_process_address, record.m_size);
1070 const bool zero_memory =
false;
1077 return error.Success();
1096 Free(record.m_process_address, err);
1115 engine.mapSectionAddress((
void *)record.m_host_address,
1116 record.m_process_address);
1120 engine.finalizeObject();
1124 bool wrote_something =
false;
1128 WriteMemory(record.m_process_address, (uint8_t *)record.m_host_address,
1129 record.m_size, err);
1131 wrote_something =
true;
1134 return wrote_something;
1142 "[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)",
1143 (
unsigned long long)m_host_address, (
unsigned long long)m_size,
1144 (
unsigned long long)m_process_address, (
unsigned)m_alignment,
1145 (
unsigned)m_section_id,
m_name.c_str());
1167 if (record.m_size > 0) {
1169 obj_file->
GetModule(), obj_file, record.m_section_id,
1171 record.m_process_address, record.m_size,
1172 record.m_host_address,
1176 record.m_permissions));
1185 return target->GetArchitecture();
1195 auto Delegate = std::static_pointer_cast<lldb_private::ObjectFileJITDelegate>(
1196 shared_from_this());
1199 lldb_private::Module::CreateModuleFromObjectFile<ObjectFileJIT>(Delegate);
1203 bool changed =
false;
1204 jit_module_sp->SetLoadAddress(*target, 0,
true, changed);
1205 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.