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/Error.h"
17#include "llvm/Support/SourceMgr.h"
18#include "llvm/Support/raw_ostream.h"
48 std::unique_ptr<llvm::Module> &module_up,
52 std::vector<std::string> &cpu_features)
77 if (function.m_name ==
m_name) {
78 func_local_addr = function.m_local_addr;
79 func_remote_addr = function.m_remote_addr;
85 "Couldn't find function {0} for disassembly",
m_name);
90 "Found function, has local address 0x%" PRIx64
91 " and remote address 0x%" PRIx64,
92 (uint64_t)func_local_addr, (uint64_t)func_remote_addr);
94 std::pair<lldb::addr_t, lldb::addr_t> func_range;
98 if (func_range.first == 0 && func_range.second == 0) {
100 "Couldn't find code range for function {0}",
m_name);
104 LLDB_LOGF(log,
"Function's code range is [0x%" PRIx64
"+0x%" PRIx64
"]",
105 func_range.first, func_range.second);
118 process->
ReadMemory(func_remote_addr, buffer_sp->GetBytes(),
119 buffer_sp->GetByteSize(), err);
129 const char *plugin_name =
nullptr;
130 const char *flavor_string =
nullptr;
131 const char *cpu_string =
nullptr;
132 const char *features_string =
nullptr;
134 arch, flavor_string, cpu_string, features_string, plugin_name);
136 if (!disassembler_sp) {
138 "Unable to find disassembler plug-in for %s architecture.",
152 LLDB_LOGF(log,
"Function data has contents:");
157 disassembler_sp->DecodeInstructions(
Address(func_remote_addr), extractor, 0,
160 InstructionList &instruction_list = disassembler_sp->GetInstructionList();
161 instruction_list.
Dump(&stream,
true,
true,
false,
168struct IRExecDiagnosticHandler :
public llvm::DiagnosticHandler {
170 IRExecDiagnosticHandler(
Status *err) : err(err) {}
171 bool handleDiagnostics(
const llvm::DiagnosticInfo &DI)
override {
172 if (DI.getSeverity() == llvm::DS_Error) {
173 const auto &DISM = llvm::cast<llvm::DiagnosticInfoSrcMgr>(DI);
176 "IRExecution error: %s",
177 DISM.getSMDiag().getMessage().str().c_str());
194 static std::recursive_mutex s_runnable_info_mutex;
202 "process because the process is invalid");
213 std::lock_guard<std::recursive_mutex> guard(s_runnable_info_mutex);
219 std::string error_string;
223 llvm::raw_string_ostream oss(s);
227 LLDB_LOGF(log,
"Module being sent to JIT: \n%s", s.c_str());
231 std::make_unique<IRExecDiagnosticHandler>(&
error));
233 llvm::EngineBuilder builder(std::move(
m_module_up));
234 llvm::Triple triple(
m_module->getTargetTriple());
236 builder.setEngineKind(llvm::EngineKind::JIT)
237 .setErrorStr(&error_string)
238 .setRelocationModel(triple.isOSBinFormatMachO() ? llvm::Reloc::PIC_
239 : llvm::Reloc::Static)
240 .setMCJITMemoryManager(std::make_unique<MemoryManager>(*
this))
241 .setOptLevel(llvm::CodeGenOptLevel::Less);
246 if (triple.isRISCV64())
247 builder.setCodeModel(llvm::CodeModel::Large);
249 llvm::StringRef mArch;
250 llvm::StringRef mCPU;
251 llvm::SmallVector<std::string, 0> mAttrs;
254 mAttrs.push_back(feature);
256 llvm::TargetMachine *target_machine =
257 builder.selectTarget(triple, mArch, mCPU, mAttrs);
263 error_string.c_str());
267 class ObjectDumper :
public llvm::ObjectCache {
269 ObjectDumper(
FileSpec output_dir) : m_out_dir(output_dir) {}
270 void notifyObjectCompiled(
const llvm::Module *module,
271 llvm::MemoryBufferRef
object)
override {
273 llvm::SmallVector<char, 256> result_path;
274 std::string object_name_model =
275 "jit-object-" +
module->getModuleIdentifier() + "-%%%.o";
278 std::string model_path = model_spec.
GetPath();
280 std::error_code result
281 = llvm::sys::fs::createUniqueFile(model_path, fd, result_path);
283 llvm::raw_fd_ostream fds(fd,
true);
284 fds.write(
object.getBufferStart(),
object.getBufferSize());
287 std::unique_ptr<llvm::MemoryBuffer>
288 getObject(
const llvm::Module *module)
override {
297 FileSpec save_objects_dir = process_sp->GetTarget().GetSaveJITObjectsDir();
298 if (save_objects_dir) {
309 for (llvm::Function &function : *
m_module) {
310 if (function.isDeclaration() || function.hasPrivateLinkage())
313 const bool external = !function.hasLocalLinkage();
317 if (!
error.Success()) {
324 "'%s' was in the JITted module but wasn't lowered",
325 function.getName().str().c_str());
329 function.getName().str().c_str(), external,
reinterpret_cast<uintptr_t
>(fun_ptr)));
341 std::function<void(llvm::GlobalValue &)> RegisterOneValue = [
this](
342 llvm::GlobalValue &val) {
343 if (val.hasExternalLinkage() && !val.isDeclaration()) {
344 uint64_t var_ptr_addr =
354 remote_addr = var_ptr_addr;
357 if (var_ptr_addr != 0)
363 for (llvm::GlobalVariable &global_var :
m_module->globals()) {
364 RegisterOneValue(global_var);
367 for (llvm::GlobalAlias &global_alias :
m_module->aliases()) {
368 RegisterOneValue(global_alias);
378 bool emitNewLine =
false;
390 "\nHint: The expression tried to call a function that is not present "
391 "in the target, perhaps because it was optimized out by the compiler.");
401 jitted_function.m_remote_addr =
404 if (!
m_name.IsEmpty() && jitted_function.m_name ==
m_name) {
413 LLDB_LOGF(log,
"Code can be run in the target.");
420 LLDB_LOGF(log,
"Couldn't disassemble function : %s",
441 record.m_process_address, 16,
447 DataExtractor my_extractor((
const void *)record.m_host_address,
449 my_extractor.
PutToLog(log, 0, record.m_size, record.m_host_address, 16,
473 switch (alloc_kind) {
492 if (name ==
"__text" || name ==
".text")
494 else if (name ==
"__data" || name ==
".data")
496 else if (name.starts_with(
"__debug_") || name.starts_with(
".debug_")) {
497 const uint32_t name_idx = name[0] ==
'_' ? 8 : 7;
498 llvm::StringRef dwarf_name(name.substr(name_idx));
500 }
else if (name.starts_with(
"__apple_") || name.starts_with(
".apple_"))
502 else if (name ==
"__objc_imageinfo")
509 uintptr_t Size,
unsigned Alignment,
unsigned SectionID,
510 llvm::StringRef SectionName) {
514 Size, Alignment, SectionID, SectionName);
517 (uintptr_t)return_value,
518 lldb::ePermissionsReadable | lldb::ePermissionsExecutable,
520 Alignment, SectionID, SectionName.str().c_str()));
523 "IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64
524 ", Alignment=%u, SectionID=%u) = %p",
525 (uint64_t)Size, Alignment, SectionID, (
void *)return_value);
527 if (
m_parent.m_reported_allocations) {
530 m_parent.GetBestExecutionContextScope()->CalculateProcess();
539 uintptr_t Size,
unsigned Alignment,
unsigned SectionID,
540 llvm::StringRef SectionName,
bool IsReadOnly) {
544 Size, Alignment, SectionID, SectionName, IsReadOnly);
546 uint32_t permissions = lldb::ePermissionsReadable;
548 permissions |= lldb::ePermissionsWritable;
550 (uintptr_t)return_value, permissions,
552 Alignment, SectionID, SectionName.str().c_str()));
554 "IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64
555 ", Alignment=%u, SectionID=%u) = %p",
556 (uint64_t)Size, Alignment, SectionID, (
void *)return_value);
558 if (
m_parent.m_reported_allocations) {
561 m_parent.GetBestExecutionContextScope()->CalculateProcess();
573 C_names.push_back(name);
577 std::vector<ConstString> &CPP_names,
578 const std::vector<ConstString> &C_names,
const SymbolContext &sc) {
582 if (cpp_lang->SymbolNameFitsToLanguage(mangled)) {
584 cpp_lang->FindBestAlternateFunctionMangledName(mangled, sc)) {
585 CPP_names.push_back(best_alternate);
589 std::vector<ConstString> alternates =
590 cpp_lang->GenerateAlternateFunctionManglings(name);
591 CPP_names.insert(CPP_names.end(), alternates.begin(), alternates.end());
596 cpp_lang->GetDemangledFunctionNameWithoutArguments(mangled);
597 CPP_names.push_back(basename);
619 if (!candidate_sc.symbol ||
621 !candidate_sc.symbol->IsWeak())
625 if (candidate_sc.symbol) {
626 load_address = candidate_sc.symbol->ResolveCallableAddress(
629 Address addr = candidate_sc.symbol->GetAddress();
630 load_address =
m_target.GetProcessSP()
638 Address addr = candidate_sc.function->GetAddress();
639 load_address =
m_target.GetProcessSP()
647 const bool is_external =
648 (candidate_sc.function) ||
649 (candidate_sc.symbol && candidate_sc.symbol->IsExternal());
679static llvm::Expected<lldb::addr_t>
682 bool &symbol_was_missing_weak) {
683 symbol_was_missing_weak =
false;
686 return llvm::createStringError(
"target not available");
690 return llvm::createStringError(
691 llvm::formatv(
"failed to find module by UID {0}", label.
module_id));
693 auto *symbol_file = module_sp->GetSymbolFile();
695 return llvm::createStringError(
696 llvm::formatv(
"no SymbolFile found on module {0:x}.", module_sp.get()));
698 auto sc_or_err = symbol_file->ResolveFunctionCallLabel(label);
700 return llvm::joinErrors(
701 llvm::createStringError(
"failed to resolve function by UID:"),
702 sc_or_err.takeError());
705 sc_list.
Append(*sc_or_err);
711 return llvm::createStringError(
"couldn't resolve address for function");
713 return resolved_addr;
719 bool &symbol_was_missing_weak) {
720 symbol_was_missing_weak =
false;
737 for (
size_t i = non_local_images.
GetSize(); i > 0; --i) {
740 non_local_images.
Remove(module_sp);
760 lldb::eFunctionNameTypeFull, function_options,
762 if (
auto load_addr = resolver.
Resolve(sc_list))
769 function_options, sc_list);
770 if (
auto load_addr = resolver.
Resolve(sc_list))
776 non_local_images.
FindFunctions(name, lldb::eFunctionNameTypeFull,
777 function_options, sc_list);
778 if (
auto load_addr = resolver.
Resolve(sc_list))
786 if (
auto load_addr = resolver.
Resolve(sc_list))
794 if (
auto load_addr = resolver.
Resolve(sc_list))
802 if (
auto load_addr = resolver.
Resolve(sc_list))
809 return best_internal_load_address;
832 lldb::addr_t symbol_load_addr = runtime->LookupRuntimeSymbol(name);
835 return symbol_load_addr;
843 const std::vector<ConstString> &names,
848 lldb::addr_t symbol_load_addr = target_sp->GetPersistentSymbol(name);
851 return symbol_load_addr;
858 bool &missing_weak) {
863 "failed to create FunctionCallLabel from '{1}': {0}",
868 if (
auto addr_or_err =
873 "Failed to resolve function call label '{1}': {0}",
880 name.
SetString(label_or_err->lookup_name);
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;
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;
982 const std::string &Name,
bool &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) {
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;
1085 if (
auto address_or_error =
1094 return error.Success();
1113 Free(record.m_process_address, err);
1132 engine.mapSectionAddress((
void *)record.m_host_address,
1133 record.m_process_address);
1137 engine.finalizeObject();
1141 bool wrote_something =
false;
1145 WriteMemory(record.m_process_address, (uint8_t *)record.m_host_address,
1146 record.m_size, err);
1148 wrote_something =
true;
1151 return wrote_something;
1159 "[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)",
1184 if (record.m_size > 0) {
1186 obj_file->
GetModule(), obj_file, record.m_section_id, record.m_name,
1187 record.m_sect_type, record.m_process_address, record.m_size,
1188 record.m_host_address,
1192 record.m_permissions);
1201 return target->GetArchitecture();
1211 auto Delegate = std::static_pointer_cast<lldb_private::ObjectFileJITDelegate>(
1212 shared_from_this());
1219 bool changed =
false;
1220 jit_module_sp->SetLoadAddress(*target, 0,
true, changed);
1221 return jit_module_sp;
static llvm::raw_ostream & error(Stream &strm)
static llvm::Expected< lldb::addr_t > ResolveFunctionCallLabel(FunctionCallLabel &label, const lldb_private::SymbolContext &sc, bool &symbol_was_missing_weak)
Returns address of the function referred to by the special function call label label.
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
#define LLDB_LOG_ERROR(log, error,...)
LoadAddressResolver(Target &target, bool &symbol_was_missing_weak)
lldb::addr_t m_best_internal_load_address
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 GetCallableLoadAddress(Target *target, bool is_indirect=false) const
Get the load address as a callable code 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.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
void SetString(llvm::StringRef s)
const char * GetCString() const
Get the string value as a C 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
std::unique_ptr< SectionMemoryManager > m_default_mm_up
The memory allocator to use in actually creating space.
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.
IRExecutionUnit & m_parent
The execution unit this is a proxy for.
~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.
std::vector< std::string > m_cpu_features
void CollectCandidateCPlusPlusNames(std::vector< ConstString > &CPP_names, const std::vector< ConstString > &C_names, const SymbolContext &sc)
static const unsigned eSectionIDInvalid
ModuleList m_preferred_modules
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
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.
void Free(lldb::addr_t process_address, Status &error)
llvm::Expected< lldb::addr_t > Malloc(size_t size, uint8_t alignment, uint32_t permissions, AllocationPolicy policy, bool zero_memory, AllocationPolicy *used_policy=nullptr)
ExecutionContextScope * GetBestExecutionContextScope() const
lldb::ProcessWP & GetProcessWP()
IRMemoryMap(lldb::TargetSP target_sp)
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.
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.
lldb::ModuleSP GetModuleAtIndex(size_t idx) const
Get the module shared pointer for the module at index idx.
size_t GetSize() const
Gets the size of the module list.
static lldb::ModuleSP CreateModuleFromObjectFile(Args &&...args)
A plug-in interface definition class for object file parsers.
static lldb::SectionType GetDWARFSectionTypeFromName(llvm::StringRef name)
Parses the section type from a section name for DWARF sections.
A plug-in interface definition class for debugging a process.
virtual size_t ReadMemory(const ProcessAddress &process_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.
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
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.
void Append(const SymbolContext &sc)
Append a new symbol context to the list.
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.
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec)
Return whether this FileSpec corresponds to a module that should be considered for general searches.
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.
constexpr llvm::StringRef FunctionCallLabelPrefix
LLDB attaches this prefix to mangled names of functions that get called from JITted expressions.
@ 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
Holds parsed information about a function call label that LLDB attaches as an AsmLabel to function AS...
static llvm::Expected< FunctionCallLabel > fromString(llvm::StringRef label)
Decodes the specified function label into a FunctionCallLabel.
lldb::user_id_t module_id
Unique identifier of the lldb_private::Module which contains the symbol identified by symbol_id.
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.