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;
129 "Found function, has local address 0x%" PRIx64
130 " and remote address 0x%" PRIx64,
131 (uint64_t)func_local_addr, (uint64_t)func_remote_addr);
133 std::pair<lldb::addr_t, lldb::addr_t> func_range;
137 if (func_range.first == 0 && func_range.second == 0) {
143 LLDB_LOGF(log,
"Function's code range is [0x%" PRIx64
"+0x%" PRIx64
"]",
144 func_range.first, func_range.second);
157 process->
ReadMemory(func_remote_addr, buffer_sp->GetBytes(),
158 buffer_sp->GetByteSize(), err);
168 const char *plugin_name =
nullptr;
169 const char *flavor_string =
nullptr;
170 const char *cpu_string =
nullptr;
171 const char *features_string =
nullptr;
173 arch, flavor_string, cpu_string, features_string, plugin_name);
175 if (!disassembler_sp) {
177 "Unable to find disassembler plug-in for %s architecture.",
191 LLDB_LOGF(log,
"Function data has contents:");
196 disassembler_sp->DecodeInstructions(
Address(func_remote_addr), extractor, 0,
199 InstructionList &instruction_list = disassembler_sp->GetInstructionList();
200 instruction_list.
Dump(&stream,
true,
true,
false,
207struct IRExecDiagnosticHandler :
public llvm::DiagnosticHandler {
209 IRExecDiagnosticHandler(
Status *err) : err(err) {}
210 bool handleDiagnostics(
const llvm::DiagnosticInfo &DI)
override {
211 if (DI.getSeverity() == llvm::DS_Error) {
212 const auto &DISM = llvm::cast<llvm::DiagnosticInfoSrcMgr>(DI);
215 "IRExecution error: %s",
216 DISM.getSMDiag().getMessage().str().c_str());
233 static std::recursive_mutex s_runnable_info_mutex;
241 "process because the process is invalid");
252 std::lock_guard<std::recursive_mutex> guard(s_runnable_info_mutex);
258 std::string error_string;
262 llvm::raw_string_ostream oss(s);
266 LLDB_LOGF(log,
"Module being sent to JIT: \n%s", s.c_str());
270 std::make_unique<IRExecDiagnosticHandler>(&
error));
272 llvm::EngineBuilder builder(std::move(
m_module_up));
273 llvm::Triple triple(
m_module->getTargetTriple());
275 builder.setEngineKind(llvm::EngineKind::JIT)
276 .setErrorStr(&error_string)
277 .setRelocationModel(triple.isOSBinFormatMachO() ? llvm::Reloc::PIC_
278 : llvm::Reloc::Static)
279 .setMCJITMemoryManager(std::make_unique<MemoryManager>(*
this))
280 .setOptLevel(llvm::CodeGenOptLevel::Less);
285 if (triple.isRISCV64())
286 builder.setCodeModel(llvm::CodeModel::Large);
288 llvm::StringRef mArch;
289 llvm::StringRef mCPU;
290 llvm::SmallVector<std::string, 0> mAttrs;
293 mAttrs.push_back(feature);
295 llvm::TargetMachine *target_machine =
296 builder.selectTarget(triple, mArch, mCPU, mAttrs);
302 error_string.c_str());
309 class ObjectDumper :
public llvm::ObjectCache {
311 ObjectDumper(
FileSpec output_dir) : m_out_dir(output_dir) {}
312 void notifyObjectCompiled(
const llvm::Module *module,
313 llvm::MemoryBufferRef
object)
override {
315 llvm::SmallVector<char, 256> result_path;
316 std::string object_name_model =
317 "jit-object-" + module->getModuleIdentifier() +
"-%%%.o";
320 std::string model_path = model_spec.
GetPath();
322 std::error_code result
323 = llvm::sys::fs::createUniqueFile(model_path, fd, result_path);
325 llvm::raw_fd_ostream fds(fd,
true);
326 fds.write(
object.getBufferStart(),
object.getBufferSize());
329 std::unique_ptr<llvm::MemoryBuffer>
330 getObject(
const llvm::Module *module)
override {
339 FileSpec save_objects_dir = process_sp->GetTarget().GetSaveJITObjectsDir();
340 if (save_objects_dir) {
351 for (llvm::Function &function : *
m_module) {
352 if (function.isDeclaration() || function.hasPrivateLinkage())
355 const bool external = !function.hasLocalLinkage();
359 if (!
error.Success()) {
366 "'%s' was in the JITted module but wasn't lowered",
367 function.getName().str().c_str());
371 function.getName().str().c_str(), external,
reinterpret_cast<uintptr_t
>(fun_ptr)));
383 std::function<void(llvm::GlobalValue &)> RegisterOneValue = [
this](
384 llvm::GlobalValue &val) {
385 if (val.hasExternalLinkage() && !val.isDeclaration()) {
386 uint64_t var_ptr_addr =
396 remote_addr = var_ptr_addr;
399 if (var_ptr_addr != 0)
405 for (llvm::GlobalVariable &global_var :
m_module->globals()) {
406 RegisterOneValue(global_var);
409 for (llvm::GlobalAlias &global_alias :
m_module->aliases()) {
410 RegisterOneValue(global_alias);
420 bool emitNewLine =
false;
432 "\nHint: The expression tried to call a function that is not present "
433 "in the target, perhaps because it was optimized out by the compiler.");
443 jitted_function.m_remote_addr =
455 LLDB_LOGF(log,
"Code can be run in the target.");
462 LLDB_LOGF(log,
"Couldn't disassemble function : %s",
483 record.m_process_address, 16,
489 DataExtractor my_extractor((
const void *)record.m_host_address,
491 my_extractor.
PutToLog(log, 0, record.m_size, record.m_host_address, 16,
508 : m_default_mm_up(new
llvm::SectionMemoryManager()), m_parent(parent) {}
515 switch (alloc_kind) {
534 if (name ==
"__text" || name ==
".text")
536 else if (name ==
"__data" || name ==
".data")
538 else if (name.starts_with(
"__debug_") || name.starts_with(
".debug_")) {
539 const uint32_t name_idx = name[0] ==
'_' ? 8 : 7;
540 llvm::StringRef dwarf_name(name.substr(name_idx));
541 switch (dwarf_name[0]) {
543 if (dwarf_name ==
"abbrev")
545 else if (dwarf_name ==
"aranges")
547 else if (dwarf_name ==
"addr")
552 if (dwarf_name ==
"frame")
557 if (dwarf_name ==
"info")
562 if (dwarf_name ==
"line")
564 else if (dwarf_name ==
"loc")
566 else if (dwarf_name ==
"loclists")
571 if (dwarf_name ==
"macinfo")
576 if (dwarf_name ==
"pubnames")
578 else if (dwarf_name ==
"pubtypes")
583 if (dwarf_name ==
"str")
585 else if (dwarf_name ==
"str_offsets")
590 if (dwarf_name ==
"ranges")
597 }
else if (name.starts_with(
"__apple_") || name.starts_with(
".apple_"))
599 else if (name ==
"__objc_imageinfo")
606 uintptr_t Size,
unsigned Alignment,
unsigned SectionID,
607 llvm::StringRef SectionName) {
610 uint8_t *return_value = m_default_mm_up->allocateCodeSection(
611 Size, Alignment, SectionID, SectionName);
614 (uintptr_t)return_value,
615 lldb::ePermissionsReadable | lldb::ePermissionsExecutable,
617 Alignment, SectionID, SectionName.str().c_str()));
620 "IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64
621 ", Alignment=%u, SectionID=%u) = %p",
622 (uint64_t)Size, Alignment, SectionID, (
void *)return_value);
624 if (m_parent.m_reported_allocations) {
627 m_parent.GetBestExecutionContextScope()->CalculateProcess();
629 m_parent.CommitOneAllocation(process_sp, err, m_parent.m_records.back());
636 uintptr_t Size,
unsigned Alignment,
unsigned SectionID,
637 llvm::StringRef SectionName,
bool IsReadOnly) {
640 uint8_t *return_value = m_default_mm_up->allocateDataSection(
641 Size, Alignment, SectionID, SectionName, IsReadOnly);
643 uint32_t permissions = lldb::ePermissionsReadable;
645 permissions |= lldb::ePermissionsWritable;
647 (uintptr_t)return_value, permissions,
649 Alignment, SectionID, SectionName.str().c_str()));
651 "IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64
652 ", Alignment=%u, SectionID=%u) = %p",
653 (uint64_t)Size, Alignment, SectionID, (
void *)return_value);
655 if (m_parent.m_reported_allocations) {
658 m_parent.GetBestExecutionContextScope()->CalculateProcess();
660 m_parent.CommitOneAllocation(process_sp, err, m_parent.m_records.back());
670 C_names.push_back(name);
674 std::vector<ConstString> &CPP_names,
675 const std::vector<ConstString> &C_names,
const SymbolContext &sc) {
679 if (cpp_lang->SymbolNameFitsToLanguage(mangled)) {
681 cpp_lang->FindBestAlternateFunctionMangledName(mangled, sc)) {
682 CPP_names.push_back(best_alternate);
686 std::vector<ConstString> alternates =
687 cpp_lang->GenerateAlternateFunctionManglings(name);
688 CPP_names.insert(CPP_names.end(), alternates.begin(), alternates.end());
693 cpp_lang->GetDemangledFunctionNameWithoutArguments(mangled);
694 CPP_names.push_back(basename);
702 : m_target(target), m_symbol_was_missing_weak(symbol_was_missing_weak) {}
712 m_symbol_was_missing_weak =
true;
716 if (!candidate_sc.symbol ||
718 !candidate_sc.symbol->IsWeak())
719 m_symbol_was_missing_weak =
false;
722 if (candidate_sc.symbol) {
723 load_address = candidate_sc.symbol->ResolveCallableAddress(*m_target);
725 Address addr = candidate_sc.symbol->GetAddress();
726 load_address = m_target->GetProcessSP()
735 candidate_sc.function->GetAddressRange().GetBaseAddress();
736 load_address = m_target->GetProcessSP() ? addr.
GetLoadAddress(m_target)
743 const bool is_external =
744 (candidate_sc.function) ||
745 (candidate_sc.symbol && candidate_sc.symbol->IsExternal());
751 m_best_internal_load_address = load_address;
757 if (m_symbol_was_missing_weak)
764 return m_best_internal_load_address;
776 bool &symbol_was_missing_weak) {
777 symbol_was_missing_weak =
false;
804 lldb::eFunctionNameTypeFull, function_options,
806 if (
auto load_addr = resolver.
Resolve(sc_list))
812 non_local_images.
FindFunctions(name, lldb::eFunctionNameTypeFull,
813 function_options, sc_list);
814 if (
auto load_addr = resolver.
Resolve(sc_list))
822 if (
auto load_addr = resolver.
Resolve(sc_list))
830 if (
auto load_addr = resolver.
Resolve(sc_list))
837 return best_internal_load_address;
860 lldb::addr_t symbol_load_addr = runtime->LookupRuntimeSymbol(name);
863 return symbol_load_addr;
871 const std::vector<ConstString> &names,
876 lldb::addr_t symbol_load_addr = target_sp->GetPersistentSymbol(name);
879 return symbol_load_addr;
886 bool &missing_weak) {
887 std::vector<ConstString> candidate_C_names;
888 std::vector<ConstString> candidate_CPlusPlus_names;
898 missing_weak =
false;
914 std::vector<lldb::addr_t> &static_initializers) {
917 llvm::GlobalVariable *global_ctors =
918 m_module->getNamedGlobal(
"llvm.global_ctors");
920 LLDB_LOG(log,
"Couldn't find llvm.global_ctors.");
924 llvm::dyn_cast<llvm::ConstantArray>(global_ctors->getInitializer());
926 LLDB_LOG(log,
"llvm.global_ctors not a ConstantArray.");
930 for (llvm::Use &ctor_use : ctor_array->operands()) {
931 auto *ctor_struct = llvm::dyn_cast<llvm::ConstantStruct>(ctor_use);
935 lldbassert(ctor_struct->getNumOperands() == 3);
936 auto *ctor_function =
937 llvm::dyn_cast<llvm::Function>(ctor_struct->getOperand(1));
938 if (!ctor_function) {
939 LLDB_LOG(log,
"global_ctor doesn't contain an llvm::Function");
943 ConstString ctor_function_name(ctor_function->getName().str());
944 LLDB_LOG(log,
"Looking for callable jitted function with name {0}.",
948 if (ctor_function_name != jitted_function.m_name)
951 LLDB_LOG(log,
"Found jitted function with invalid address.");
954 static_initializers.push_back(jitted_function.m_remote_addr);
955 LLDB_LOG(log,
"Calling function at address {0:x}.",
956 jitted_function.m_remote_addr);
964 bool missing_weak =
false;
965 uint64_t addr = GetSymbolAddressAndPresence(Name, missing_weak);
968 return llvm::JITSymbol(addr,
969 llvm::JITSymbolFlags::Exported | llvm::JITSymbolFlags::Weak);
971 return llvm::JITSymbol(addr, llvm::JITSymbolFlags::Exported);
976 bool missing_weak =
false;
977 return GetSymbolAddressAndPresence(Name, missing_weak);
982 const std::string &Name,
bool &missing_weak) {
987 lldb::addr_t ret = m_parent.FindSymbol(name_cs, missing_weak);
991 "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>",
994 m_parent.ReportSymbolLookupError(name_cs);
997 LLDB_LOGF(log,
"IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64,
1004 const std::string &Name,
bool AbortOnFailure) {
1005 return (
void *)getSymbolAddress(Name);
1013 if (local_address >= record.m_host_address &&
1014 local_address < record.m_host_address + record.m_size) {
1019 record.m_process_address + (local_address - record.m_host_address);
1022 "IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64
1023 " in [0x%" PRIx64
"..0x%" PRIx64
"], and returned 0x%" PRIx64
1024 " from [0x%" PRIx64
"..0x%" PRIx64
"].",
1025 local_address, (uint64_t)record.m_host_address,
1026 (uint64_t)record.m_host_address + (uint64_t)record.m_size, ret,
1027 record.m_process_address,
1028 record.m_process_address + record.m_size);
1040 if (local_address >= record.m_host_address &&
1041 local_address < record.m_host_address + record.m_size) {
1045 return AddrRange(record.m_process_address, record.m_size);
1084 const bool zero_memory =
false;
1091 return error.Success();
1110 Free(record.m_process_address, err);
1129 engine.mapSectionAddress((
void *)record.m_host_address,
1130 record.m_process_address);
1134 engine.finalizeObject();
1138 bool wrote_something =
false;
1142 WriteMemory(record.m_process_address, (uint8_t *)record.m_host_address,
1143 record.m_size, err);
1145 wrote_something =
true;
1148 return wrote_something;
1156 "[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)",
1157 (
unsigned long long)m_host_address, (
unsigned long long)m_size,
1158 (
unsigned long long)m_process_address, (
unsigned)m_alignment,
1159 (
unsigned)m_section_id,
m_name.c_str());
1181 if (record.m_size > 0) {
1183 obj_file->
GetModule(), obj_file, record.m_section_id,
1185 record.m_process_address, record.m_size,
1186 record.m_host_address,
1190 record.m_permissions));
1199 return target->GetArchitecture();
1209 auto Delegate = std::static_pointer_cast<lldb_private::ObjectFileJITDelegate>(
1210 shared_from_this());
1213 lldb_private::Module::CreateModuleFromObjectFile<ObjectFileJIT>(Delegate);
1217 bool changed =
false;
1218 jit_module_sp->SetLoadAddress(*target, 0,
true, changed);
1219 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 *cpu, const char *features, 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 collection class for Module objects.
void FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list) const
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
bool Remove(const lldb::ModuleSP &module_sp, bool notify=true)
Remove a module from the module list.
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.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
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 ModuleList & GetImages() const
Get accessor for the images for this process.
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.