39#ifdef ENABLE_DEBUG_PRINTF
41#define DEBUG_PRINTF(fmt, ...) printf(fmt, ##__VA_ARGS__)
43#define DEBUG_PRINTF(fmt, ...)
59 :
DynamicLoader(process), m_dyld_module_wp(), m_libpthread_module_wp(),
60 m_pthread_getspecific_addr(), m_tid_to_tls_map(), m_dyld_image_infos(),
61 m_dyld_image_infos_stop_id(
UINT32_MAX), m_dyld(), m_mutex() {}
88 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
97 ImageInfo &image_info,
bool can_create,
bool *did_create_ptr) {
99 *did_create_ptr =
false;
109 if (target_triple.getOS() == llvm::Triple::IOS &&
110 target_triple.getEnvironment() == llvm::Triple::MacABI) {
120 !module_sp->GetUUID().IsValid()) {
123 if (module_sp->GetModificationTime() !=
128 if (module_sp || !can_create)
131 if (HostInfo::GetArchitecture().IsCompatibleMatch(target.
GetArchitecture())) {
142 if (image_info.
uuid &&
154 if (!module_sp || module_sp->GetObjectFile() ==
nullptr)
159 *did_create_ptr = (bool)module_sp;
165 const std::vector<lldb::addr_t> &solib_addresses) {
166 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
172 LLDB_LOGF(log,
"Removing %" PRId64
" modules.",
173 (uint64_t)solib_addresses.size());
177 for (
addr_t solib_addr : solib_addresses) {
181 ModuleSP module_to_remove(header.
GetModule());
182 if (module_to_remove.get()) {
183 LLDB_LOGF(log,
"Removing module at address 0x%" PRIx64, solib_addr);
191 if (solib_addr == (*pos).address) {
201 if (unloaded_module_list.
GetSize() > 0) {
205 log,
"DynamicLoaderDarwin::UnloadModules");
218 std::lock_guard<std::recursive_mutex> guard(target_modules.
GetMutex());
221 for (ModuleSP module_sp : target_modules.
Modules()) {
224 if (module_sp && module_sp != dyld_sp) {
226 unloaded_modules_list.
Append(module_sp);
230 if (unloaded_modules_list.
GetSize() != 0) {
234 log,
"DynamicLoaderDarwin::UnloadAllImages");
246 bool changed =
false;
249 if (image_object_file) {
252 std::vector<uint32_t> inaccessible_segment_indexes;
255 const size_t num_segments = info.
segments.size();
256 for (
size_t i = 0; i < num_segments; ++i) {
259 SectionSP section_sp(
262 if (info.
segments[i].maxprot == 0) {
263 inaccessible_segment_indexes.push_back(i);
265 const addr_t new_section_load_addr =
267 static ConstString g_section_name_LINKEDIT(
"__LINKEDIT");
274 const bool warn_multiple =
275 section_sp->GetName() != g_section_name_LINKEDIT;
278 section_sp, new_section_load_addr, warn_multiple);
289 if (changed && !inaccessible_segment_indexes.empty()) {
290 for (
uint32_t i = 0; i < inaccessible_segment_indexes.size(); ++i) {
291 const uint32_t seg_idx = inaccessible_segment_indexes[i];
292 SectionSP section_sp(
296 static ConstString g_pagezero_section_name(
"__PAGEZERO");
297 if (g_pagezero_section_name == section_sp->GetName()) {
323 bool changed =
false;
326 if (image_object_file) {
329 const size_t num_segments = info.
segments.size();
330 for (
size_t i = 0; i < num_segments; ++i) {
331 SectionSP section_sp(
334 const addr_t old_section_load_addr =
337 section_sp, old_section_load_addr))
341 llvm::formatv(
"unable to find and unload segment named "
342 "'{0}' in '{1}' in macosx dynamic loader plug-in",
343 info.
segments[i].name.AsCString(
"<invalid>"),
360 image_details->GetAsDictionary()->GetValueForKey(
"images");
361 if (images_sp.get() ==
nullptr)
364 image_infos.resize(images_sp->GetAsArray()->GetSize());
366 for (
size_t i = 0; i < image_infos.size(); i++) {
368 images_sp->GetAsArray()->GetItemAtIndex(i);
369 if (image_sp.get() ==
nullptr || image_sp->GetAsDictionary() ==
nullptr)
373 if (!image->
HasKey(
"load_address") ||
374 !image->
HasKey(
"pathname") ||
375 !image->
HasKey(
"mod_date") ||
376 !image->
HasKey(
"mach_header") ||
377 image->
GetValueForKey(
"mach_header")->GetAsDictionary() ==
nullptr ||
378 !image->
HasKey(
"segments") ||
384 image_infos[i].address =
385 image->
GetValueForKey(
"load_address")->GetAsInteger()->GetValue();
386 image_infos[i].mod_date =
388 image_infos[i].file_spec.SetFile(
390 FileSpec::Style::native);
394 image_infos[i].header.magic =
396 image_infos[i].header.cputype =
398 image_infos[i].header.cpusubtype =
400 image_infos[i].header.filetype =
403 if (image->
HasKey(
"min_version_os_name")) {
404 std::string os_name =
408 if (os_name ==
"macosx")
409 image_infos[i].os_type = llvm::Triple::MacOSX;
410 else if (os_name ==
"ios" || os_name ==
"iphoneos")
411 image_infos[i].os_type = llvm::Triple::IOS;
412 else if (os_name ==
"tvos")
413 image_infos[i].os_type = llvm::Triple::TvOS;
414 else if (os_name ==
"watchos")
415 image_infos[i].os_type = llvm::Triple::WatchOS;
418 else if (os_name ==
"maccatalyst") {
419 image_infos[i].os_type = llvm::Triple::IOS;
420 image_infos[i].os_env = llvm::Triple::MacABI;
421 }
else if (os_name ==
"iossimulator") {
422 image_infos[i].os_type = llvm::Triple::IOS;
423 image_infos[i].os_env = llvm::Triple::Simulator;
424 }
else if (os_name ==
"tvossimulator") {
425 image_infos[i].os_type = llvm::Triple::TvOS;
426 image_infos[i].os_env = llvm::Triple::Simulator;
427 }
else if (os_name ==
"watchossimulator") {
428 image_infos[i].os_type = llvm::Triple::WatchOS;
429 image_infos[i].os_env = llvm::Triple::Simulator;
432 if (image->
HasKey(
"min_version_os_sdk")) {
433 image_infos[i].min_version_os_sdk =
443 image_infos[i].header.flags =
446 image_infos[i].header.flags = 0;
449 image_infos[i].header.ncmds =
452 image_infos[i].header.ncmds = 0;
454 if (mh->
HasKey(
"sizeofcmds"))
455 image_infos[i].header.sizeofcmds =
458 image_infos[i].header.sizeofcmds = 0;
463 for (
size_t j = 0; j < segcount; j++) {
483 if (seg->
HasKey(
"initprot"))
495 if (seg->
HasKey(
"nsects"))
501 image_infos[i].segments.push_back(segment);
504 image_infos[i].uuid.SetFromStringRef(
514 const size_t num_sections = image_infos[i].segments.size();
515 for (
size_t k = 0; k < num_sections; ++k) {
518 if ((image_infos[i].segments[k].fileoff == 0 &&
519 image_infos[i].segments[k].filesize > 0) ||
520 (image_infos[i].segments[k].name ==
"__TEXT")) {
521 image_infos[i].slide =
522 image_infos[i].address - image_infos[i].segments[k].vmaddr;
541 const size_t image_infos_size = image_infos.size();
542 for (
size_t i = 0; i < image_infos_size; i++) {
543 if (image_infos[i].header.filetype == llvm::MachO::MH_DYLINKER) {
548 if (target_arch.
GetTriple().getEnvironment() == llvm::Triple::Simulator &&
549 image_infos[i].os_type != llvm::Triple::OSType::MacOSX) {
555 if (image_infos[i].header.filetype == llvm::MachO::MH_EXECUTE) {
562 const bool can_create =
true;
564 can_create,
nullptr));
566 LLDB_LOGF(log,
"Found executable module: %s",
567 exe_module_sp->GetFileSpec().GetPath().c_str());
574 auto exe_triple = exe_module_sp->GetArchitecture().GetTriple();
575 if (target_arch.
GetTriple().isArm64e() &&
576 exe_triple.getArch() == llvm::Triple::aarch64 &&
577 !exe_triple.isArm64e()) {
587 triple.setArchName(exe_triple.getArchName());
596 const bool can_create =
true;
598 can_create,
nullptr);
601 dyld_sp->GetFileSpec().GetPath().c_str());
611 if (image_info.
header.filetype == llvm::MachO::MH_DYLINKER) {
612 const bool can_create =
true;
637 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
644 for (
uint32_t idx = 0; idx < image_infos.size(); ++idx) {
646 LLDB_LOGF(log,
"Adding new image at address=0x%16.16" PRIx64
".",
647 image_infos[idx].address);
648 image_infos[idx].PutToLog(log);
653 ModuleSP image_module_sp(
656 if (image_module_sp) {
657 ObjectFile *objfile = image_module_sp->GetObjectFile();
664 if (commpage_section) {
666 image_infos[idx].GetArchitecture());
668 ModuleSP commpage_image_module_sp(
670 if (!commpage_image_module_sp) {
676 if (!commpage_image_module_sp ||
677 commpage_image_module_sp->GetObjectFile() ==
nullptr) {
679 image_infos[idx].file_spec, image_infos[idx].address);
684 bool changed =
false;
709 ArchSpec dyld_spec = image_infos[idx].GetArchitecture();
710 auto &dyld_triple = dyld_spec.
GetTriple();
711 if ((dyld_triple.getEnvironment() == llvm::Triple::MacABI &&
712 dyld_triple.getOS() == llvm::Triple::IOS) ||
713 (dyld_triple.getEnvironment() == llvm::Triple::Simulator &&
714 (dyld_triple.getOS() == llvm::Triple::IOS ||
715 dyld_triple.getOS() == llvm::Triple::TvOS ||
716 dyld_triple.getOS() == llvm::Triple::WatchOS)))
717 image_module_sp->MergeArchitecture(dyld_spec);
721 if (loaded_module_list.
GetSize() > 0) {
724 "DynamicLoaderDarwin::ModulesDidLoad");
747 if (module_sp.get() ==
nullptr && sym_ctx.
function) {
751 if (module_sp.get() ==
nullptr)
755 return objc_runtime !=
nullptr &&
764 LLDB_LOGF(log,
"\t\t%16s [0x%16.16" PRIx64
" - 0x%16.16" PRIx64
")",
768 "\t\t%16s [0x%16.16" PRIx64
" - 0x%16.16" PRIx64
769 ") slide = 0x%" PRIx64,
779 if (os_env == llvm::Triple::MacABI && os_type == llvm::Triple::IOS) {
781 "-apple-ios" + min_version_os_sdk +
"-macabi");
786 if (os_env == llvm::Triple::Simulator &&
787 (os_type == llvm::Triple::IOS || os_type == llvm::Triple::TvOS ||
788 os_type == llvm::Triple::WatchOS)) {
790 "-apple-" + llvm::Triple::getOSTypeName(os_type) +
791 min_version_os_sdk +
"-simulator");
801 const size_t num_segments = segments.size();
802 for (
size_t i = 0; i < num_segments; ++i) {
803 if (segments[i].name == name)
814 LLDB_LOG(log,
"modtime={0:x+8} uuid={1} path='{2}' (UNLOADED)", mod_date,
815 uuid.GetAsString(), file_spec.GetPath());
817 LLDB_LOG(log,
"address={0:x+16} modtime={1:x+8} uuid={2} path='{3}'",
818 address, mod_date, uuid.GetAsString(), file_spec.GetPath());
819 for (
uint32_t i = 0; i < segments.size(); ++i)
820 segments[i].PutToLog(log, slide);
825 DEBUG_PRINTF(
"DynamicLoaderDarwin::%s() process state = %s\n", __FUNCTION__,
835 DEBUG_PRINTF(
"DynamicLoaderDarwin::%s(%s)\n", __FUNCTION__,
870 ThreadPlanSP thread_plan_sp;
878 if (current_symbol !=
nullptr) {
879 std::vector<Address> addresses;
883 current_symbol->
GetMangled().GetName(Mangled::ePreferMangled);
885 if (trampoline_name) {
886 const ModuleList &images = target_sp->GetImages();
891 size_t num_code_symbols = code_symbols.
GetSize();
893 if (num_code_symbols > 0) {
894 for (
uint32_t i = 0; i < num_code_symbols; i++) {
906 "Found a trampoline target symbol at 0x%" PRIx64
".",
916 size_t num_reexported_symbols = reexported_symbols.
GetSize();
917 if (num_reexported_symbols > 0) {
918 for (
uint32_t i = 0; i < num_reexported_symbols; i++) {
925 const Address actual_symbol_addr =
927 if (actual_symbol_addr.
IsValid()) {
928 addresses.push_back(actual_symbol_addr);
934 "Found a re-exported symbol: %s at 0x%" PRIx64
".",
947 size_t num_indirect_symbols = indirect_symbols.
GetSize();
948 if (num_indirect_symbols > 0) {
949 for (
uint32_t i = 0; i < num_indirect_symbols; i++) {
961 "Found an indirect target symbol at 0x%" PRIx64
".",
972 const Symbol *actual_symbol =
979 "Found a re-exported symbol: %s pointing to: %s at 0x%" PRIx64
989 if (addresses.size() > 0) {
992 std::vector<lldb::addr_t> load_addrs;
993 for (
Address address : addresses) {
999 &symbol_address,
error);
1000 if (
error.Success()) {
1001 load_addrs.push_back(resolved_addr);
1003 "ResolveIndirectFunction found resolved target for "
1004 "%s at 0x%" PRIx64
".",
1008 load_addrs.push_back(address.GetLoadAddress(target_sp.get()));
1011 thread_plan_sp = std::make_shared<ThreadPlanRunToAddress>(
1012 thread, load_addrs, stop_others);
1015 LLDB_LOGF(log,
"Could not find symbol for step through.");
1018 return thread_plan_sp;
1025 original_symbol->
GetMangled().GetName(Mangled::ePreferMangled);
1026 if (!trampoline_name)
1029 static const char *resolver_name_regex =
"(_gc|_non_gc|\\$[A-Za-z0-9\\$]+)$";
1030 std::string equivalent_regex_buf(
"^");
1031 equivalent_regex_buf.append(trampoline_name.
GetCString());
1032 equivalent_regex_buf.append(resolver_name_regex);
1036 equivalent_symbols);
1049 if (module_list.
GetSize() == 1) {
1064 module_sp->FindSymbolsWithNameAndType(
ConstString(
"pthread_getspecific"),
1078 const lldb::ThreadSP thread_sp,
1080 if (!thread_sp || !module_sp)
1083 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1089 if (module_sp->ResolveFileAddress(tls_file_addr, tls_addr)) {
1091 const size_t tsl_data_size = addr_size * 3;
1096 DataExtractor data(buf,
sizeof(buf), byte_order, addr_size);
1100 if (pthread_key != 0) {
1105 const tid_t tid = thread_sp->GetID();
1108 auto tls_pos = tid_pos->second.find(pthread_key);
1109 if (tls_pos != tid_pos->second.end()) {
1110 return tls_pos->second + tls_offset;
1113 StackFrameSP frame_sp = thread_sp->GetStackFrameAtIndex(0);
1115 TypeSystemClangSP scratch_ts_sp =
1124 if (pthread_getspecific_addr.
IsValid()) {
1128 *thread_sp, pthread_getspecific_addr, clang_void_ptr_type,
1129 llvm::ArrayRef<lldb::addr_t>(pthread_key), options));
1134 exe_ctx, thread_plan_sp, options, execution_errors);
1137 lldb::ValueObjectSP result_valobj_sp =
1138 thread_plan_sp->GetReturnValueObject();
1139 if (result_valobj_sp) {
1141 result_valobj_sp->GetValueAsUnsigned(0);
1142 if (pthread_key_data) {
1144 std::make_pair(pthread_key, pthread_key_data));
1145 return pthread_key_data + tls_offset;
1159 bool use_new_spi_interface =
false;
1162 if (!version.empty()) {
1163 const llvm::Triple::OSType os_type =
1167 if (os_type == llvm::Triple::MacOSX &&
1168 version >= llvm::VersionTuple(10, 12))
1169 use_new_spi_interface =
true;
1172 if (os_type == llvm::Triple::IOS && version >= llvm::VersionTuple(10))
1173 use_new_spi_interface =
true;
1176 if (os_type == llvm::Triple::TvOS && version >= llvm::VersionTuple(10))
1177 use_new_spi_interface =
true;
1180 if (os_type == llvm::Triple::WatchOS && version >= llvm::VersionTuple(3))
1181 use_new_spi_interface =
true;
1189 if (use_new_spi_interface)
1191 log,
"DynamicLoaderDarwin::UseDYLDSPI: Use new DynamicLoader plugin");
1194 log,
"DynamicLoaderDarwin::UseDYLDSPI: Use old DynamicLoader plugin");
1196 return use_new_spi_interface;
static llvm::raw_ostream & error(Stream &strm)
#define DEBUG_PRINTF(fmt,...)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
lldb::addr_t GetOffset() const
Get the section relative offset value.
bool IsValid() const
Check if the object state is valid.
An architecture specification class.
llvm::Triple & GetTriple()
Architecture triple accessor.
bool SetTriple(const llvm::Triple &triple)
Architecture triple setter.
void MergeFrom(const ArchSpec &other)
Merges fields from another ArchSpec into this ArchSpec.
bool IsCompatibleMatch(const ArchSpec &rhs) const
Shorthand for IsMatch(rhs, CompatibleMatch).
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Generic representation of a type in a programming language.
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report warning events.
lldb_private::ConstString name
void PutToLog(lldb_private::Log *log, lldb::addr_t slide) const
lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr) override
Retrieves the per-module TLS block for a given thread.
lldb::ModuleSP GetDYLDModule()
void UpdateSpecialBinariesFromNewImageInfos(ImageInfo::collection &image_infos)
bool AlwaysRelyOnEHUnwindInfo(lldb_private::SymbolContext &sym_ctx) override
Ask if the eh_frame information for the given SymbolContext should be relied on even when it's the fi...
virtual bool NeedToDoInitialImageFetch()=0
ImageInfo::collection m_dyld_image_infos
virtual void DoInitialImageFetch()=0
DynamicLoaderDarwin(lldb_private::Process *process)
std::recursive_mutex m_mutex
uint32_t m_dyld_image_infos_stop_id
void UpdateDYLDImageInfoFromNewImageInfo(ImageInfo &image_info)
void PrivateProcessStateChanged(lldb_private::Process *process, lldb::StateType state)
void DidLaunch() override
Called after attaching a process.
lldb::ModuleWP m_dyld_module_wp
void FindEquivalentSymbols(lldb_private::Symbol *original_symbol, lldb_private::ModuleList &module_list, lldb_private::SymbolContextList &equivalent_symbols) override
Some dynamic loaders provide features where there are a group of symbols "equivalent to" a given symb...
virtual bool SetNotificationBreakpoint()=0
bool AddModulesUsingImageInfos(ImageInfo::collection &image_infos)
void DidAttach() override
Called after attaching a process.
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override
Provides a plan to step through the dynamic loader trampoline for the current state of thread.
lldb::ModuleWP m_libpthread_module_wp
bool JSONImageInformationIntoImageInfo(lldb_private::StructuredData::ObjectSP image_details, ImageInfo::collection &image_infos)
bool UpdateImageLoadAddress(lldb_private::Module *module, ImageInfo &info)
lldb::ModuleSP FindTargetModuleForImageInfo(ImageInfo &image_info, bool can_create, bool *did_create_ptr)
void PrivateInitialize(lldb_private::Process *process)
~DynamicLoaderDarwin() override
lldb_private::Address GetPthreadSetSpecificAddress()
void Clear(bool clear_process)
void SetDYLDModule(lldb::ModuleSP &dyld_module_sp)
ThreadIDToTLSMap m_tid_to_tls_map
static bool UseDYLDSPI(lldb_private::Process *process)
lldb_private::Address m_pthread_getspecific_addr
bool UnloadModuleSections(lldb_private::Module *module, ImageInfo &info)
lldb::ModuleSP GetPThreadLibraryModule()
void UnloadImages(const std::vector< lldb::addr_t > &solib_addresses)
virtual bool DidSetNotificationBreakpoint()=0
A plug-in interface definition class for dynamic loaders.
Process * m_process
The process that this dynamic loader plug-in is tracking.
virtual void UnloadSections(const lldb::ModuleSP module)
Removes the loaded sections from the target in module.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
void SetFilename(ConstString filename)
Filename string set accessor.
llvm::sys::TimePoint GetModificationTime(const FileSpec &file_spec) const
Returns the modification time of the given file.
static FileSystem & Instance()
const AddressRange & GetAddressRange()
void PutCString(const char *cstr)
A collection class for Module objects.
std::recursive_mutex & GetMutex() const
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const
bool Remove(const lldb::ModuleSP &module_sp, bool notify=true)
Remove a module from the module list.
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
void FindModules(const ModuleSpec &module_spec, ModuleList &matching_module_list) const
Finds the first module whose file specification matches file_spec.
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
lldb::ModuleSP GetModuleAtIndex(size_t idx) const
Get the module shared pointer for the module at index idx.
bool AppendIfNeeded(const lldb::ModuleSP &new_module, bool notify=true)
Append a module to the module list, if it is not already there.
void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
ModuleIterable Modules() const
size_t GetSize() const
Gets the size of the module list.
void LogUUIDAndPaths(Log *log, const char *prefix_cstr)
void SetObjectSize(uint64_t object_size)
ConstString & GetObjectName()
ArchSpec & GetArchitecture()
void SetObjectOffset(uint64_t object_offset)
A class that describes an executable image and its associated object and symbol files.
virtual ObjectFile * GetObjectFile()
Get the object file representation for the current architecture.
virtual bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp)=0
static ObjCLanguageRuntime * Get(Process &process)
A plug-in interface definition class for object file parsers.
virtual lldb::addr_t GetFileOffset() const
Returns the offset into a file at which this object resides.
virtual FileSpec & GetFileSpec()
Get accessor to the object file specification.
virtual SectionList * GetSectionList(bool update_module_section_list=true)
Gets the section list for the currently selected architecture (and object for archives).
virtual lldb::addr_t GetByteSize() const
A plug-in interface definition class for debugging a process.
lldb::ExpressionResults RunThreadPlan(ExecutionContext &exe_ctx, lldb::ThreadPlanSP &thread_plan_sp, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager)
void AddInvalidMemoryRegion(const LoadRange ®ion)
lldb::ByteOrder GetByteOrder() const
lldb::StateType GetState()
Get accessor for the current process state.
virtual llvm::VersionTuple GetHostOSVersion()
Sometimes the connection to a process can detect the host OS version that the process is running on.
virtual bool IsAlive()
Check if a process is still alive.
uint32_t GetAddressByteSize() const
uint32_t GetStopID() const
lldb::ModuleSP ReadModuleFromMemory(const FileSpec &file_spec, lldb::addr_t header_addr, size_t size_to_read=512)
Target & GetTarget()
Get the target object pointer for this module.
static lldb::TypeSystemClangSP GetForTarget(Target &target, std::optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
lldb::SectionSP FindSectionByName(ConstString section_dstr) const
lldb::offset_t GetFileOffset() const
This base class provides an interface to stack frames.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
ObjectSP GetItemAtIndex(size_t idx) const
ObjectSP GetValueForKey(llvm::StringRef key) const
bool HasKey(llvm::StringRef key) const
Dictionary * GetAsDictionary()
std::shared_ptr< Object > ObjectSP
Defines a list of symbol context objects.
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
uint32_t GetSize() const
Get accessor for a symbol context list size.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
bool GetAddressRange(uint32_t scope, uint32_t range_idx, bool use_inline_block_range, AddressRange &range) const
Get the address range contained within a symbol context.
Symbol * symbol
The Symbol for a given query.
bool IsTrampoline() const
Address & GetAddressRef()
ConstString GetName() const
lldb::SymbolType GetType() const
Address GetAddress() const
Symbol * ResolveReExportedSymbol(Target &target) const
Symbol * CalculateSymbolContextSymbol() override
void ModulesDidLoad(ModuleList &module_list)
Module * GetExecutableModulePointer()
void ClearAllLoadedSections()
bool SetSectionUnloaded(const lldb::SectionSP §ion_sp)
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
size_t ReadMemory(const Address &addr, void *dst, size_t dst_len, Status &error, bool force_live_memory=false, lldb::addr_t *load_addr_ptr=nullptr)
bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform=false, bool merge=true)
Set the architecture for this target.
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
const ModuleList & GetImages() const
Get accessor for the images for this process.
const ArchSpec & GetArchitecture() const
void SetExecutableModule(lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files=eLoadDependentsDefault)
Set the main executable module.
bool SetSectionLoadAddress(const lldb::SectionSP §ion, lldb::addr_t load_addr, bool warn_multiple=false)
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
lldb::TargetSP CalculateTarget() override
lldb::ProcessSP GetProcess() const
#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.
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
StateType
Process and Thread States.
@ eStateUnloaded
Process is object is valid, but not currently loaded.
@ eStateConnected
Process is connected to remote debug services, but not launched or attached to anything yet.
@ eStateDetached
Process has been detached and can't be examined.
@ eStateStopped
Process or thread is stopped and can be examined.
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
@ eStateRunning
Process or thread is running and can't be examined.
@ eStateLaunching
Process is in the process of launching.
@ eStateAttaching
Process is currently trying to attach.
@ eStateExited
Process has exited and can't be examined.
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
@ eStateCrashed
Process or thread has crashed and can be examined.
ExpressionResults
The results of expression evaluation.
ByteOrder
Byte ordering definitions.
lldb_private::ArchSpec GetArchitecture() const
std::vector< ImageInfo > collection
lldb_private::UUID uuid
UUID for this dylib if it has one, else all zeros.
lldb::addr_t address
Address of mach header for this dylib.
lldb::addr_t slide
The amount to slide all segments by if there is a global slide.
llvm::MachO::mach_header header
The mach header for this image.
std::vector< Segment > segments
All segment vmaddr and vmsize pairs for this executable (from memory of inferior).
const Segment * FindSegment(lldb_private::ConstString name) const
lldb_private::FileSpec file_spec
Resolved path for this dylib.
void Clear(bool load_cmd_data_only)
uint32_t load_stop_id
The process stop ID that the sections for this image were loaded.
void PutToLog(lldb_private::Log *log) const
lldb::DataBufferSP data_sp