35#include "llvm/Support/ThreadPool.h"
41#ifdef ENABLE_DEBUG_PRINTF
43#define DEBUG_PRINTF(fmt, ...) printf(fmt, ##__VA_ARGS__)
45#define DEBUG_PRINTF(fmt, ...)
55 :
DynamicLoader(process), m_dyld_module_wp(), m_libpthread_module_wp(),
56 m_pthread_getspecific_addr(), m_tid_to_tls_map(), m_dyld_image_infos(),
57 m_dyld_image_infos_stop_id(
UINT32_MAX), m_dyld(), m_mutex() {}
85 const bool is_global_setting =
true;
89 "Properties for the DynamicLoaderDarwin plug-in.", is_global_setting);
95 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
104 const ImageInfo &image_info,
bool can_create,
bool *did_create_ptr) {
106 *did_create_ptr =
false;
116 if (target_triple.getOS() == llvm::Triple::IOS &&
117 target_triple.getEnvironment() == llvm::Triple::MacABI) {
127 !module_sp->GetUUID().IsValid()) {
130 if (module_sp->GetModificationTime() !=
135 if (module_sp || !can_create)
138 if (HostInfo::GetArchitecture().IsCompatibleMatch(target.
GetArchitecture())) {
149 if (image_info.
uuid &&
161 if (!module_sp || module_sp->GetObjectFile() ==
nullptr)
166 *did_create_ptr = (bool)module_sp;
172 const std::vector<lldb::addr_t> &solib_addresses) {
173 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
179 LLDB_LOGF(log,
"Removing %" PRId64
" modules.",
180 (uint64_t)solib_addresses.size());
184 for (
addr_t solib_addr : solib_addresses) {
189 if (module_to_remove.get()) {
190 LLDB_LOGF(log,
"Removing module at address 0x%" PRIx64, solib_addr);
198 if (solib_addr == (*pos).address) {
208 if (unloaded_module_list.
GetSize() > 0) {
212 log,
"DynamicLoaderDarwin::UnloadModules");
225 std::lock_guard<std::recursive_mutex> guard(target_modules.
GetMutex());
231 if (module_sp && module_sp != dyld_sp) {
233 unloaded_modules_list.
Append(module_sp);
237 if (unloaded_modules_list.
GetSize() != 0) {
241 log,
"DynamicLoaderDarwin::UnloadAllImages");
253 bool changed =
false;
256 if (image_object_file) {
259 std::vector<uint32_t> inaccessible_segment_indexes;
262 const size_t num_segments = info.
segments.size();
263 for (
size_t i = 0; i < num_segments; ++i) {
269 if (info.
segments[i].maxprot == 0) {
270 inaccessible_segment_indexes.push_back(i);
272 const addr_t new_section_load_addr =
274 static ConstString g_section_name_LINKEDIT(
"__LINKEDIT");
281 const bool warn_multiple =
282 section_sp->GetName() != g_section_name_LINKEDIT;
285 section_sp, new_section_load_addr, warn_multiple);
296 if (changed && !inaccessible_segment_indexes.empty()) {
297 for (uint32_t i = 0; i < inaccessible_segment_indexes.size(); ++i) {
298 const uint32_t seg_idx = inaccessible_segment_indexes[i];
303 static ConstString g_pagezero_section_name(
"__PAGEZERO");
304 if (g_pagezero_section_name == section_sp->GetName()) {
330 bool changed =
false;
333 if (image_object_file) {
336 const size_t num_segments = info.
segments.size();
337 for (
size_t i = 0; i < num_segments; ++i) {
341 const addr_t old_section_load_addr =
344 section_sp, old_section_load_addr))
348 llvm::formatv(
"unable to find and unload segment named "
349 "'{0}' in '{1}' in macosx dynamic loader plug-in",
350 info.
segments[i].name.AsCString(
"<invalid>"),
367 image_details->GetAsDictionary()->GetValueForKey(
"images");
368 if (images_sp.get() ==
nullptr)
371 image_infos.resize(images_sp->GetAsArray()->GetSize());
373 for (
size_t i = 0; i < image_infos.size(); i++) {
375 images_sp->GetAsArray()->GetItemAtIndex(i);
376 if (image_sp.get() ==
nullptr || image_sp->GetAsDictionary() ==
nullptr)
380 if (!image->
HasKey(
"load_address") ||
381 !image->
HasKey(
"pathname") ||
382 !image->
HasKey(
"mach_header") ||
383 image->
GetValueForKey(
"mach_header")->GetAsDictionary() ==
nullptr ||
384 !image->
HasKey(
"segments") ||
390 image_infos[i].address =
392 image_infos[i].file_spec.SetFile(
394 FileSpec::Style::native);
398 image_infos[i].header.magic =
400 image_infos[i].header.cputype =
402 image_infos[i].header.cpusubtype =
404 image_infos[i].header.filetype =
407 if (image->
HasKey(
"min_version_os_name")) {
408 std::string os_name =
412 if (os_name ==
"macosx")
413 image_infos[i].os_type = llvm::Triple::MacOSX;
414 else if (os_name ==
"ios" || os_name ==
"iphoneos")
415 image_infos[i].os_type = llvm::Triple::IOS;
416 else if (os_name ==
"tvos")
417 image_infos[i].os_type = llvm::Triple::TvOS;
418 else if (os_name ==
"watchos")
419 image_infos[i].os_type = llvm::Triple::WatchOS;
420 else if (os_name ==
"bridgeos")
421 image_infos[i].os_type = llvm::Triple::BridgeOS;
422 else if (os_name ==
"maccatalyst") {
423 image_infos[i].os_type = llvm::Triple::IOS;
424 image_infos[i].os_env = llvm::Triple::MacABI;
425 }
else if (os_name ==
"iossimulator") {
426 image_infos[i].os_type = llvm::Triple::IOS;
427 image_infos[i].os_env = llvm::Triple::Simulator;
428 }
else if (os_name ==
"tvossimulator") {
429 image_infos[i].os_type = llvm::Triple::TvOS;
430 image_infos[i].os_env = llvm::Triple::Simulator;
431 }
else if (os_name ==
"watchossimulator") {
432 image_infos[i].os_type = llvm::Triple::WatchOS;
433 image_infos[i].os_env = llvm::Triple::Simulator;
436 if (image->
HasKey(
"min_version_os_sdk")) {
437 image_infos[i].min_version_os_sdk =
447 image_infos[i].header.flags =
450 image_infos[i].header.flags = 0;
453 image_infos[i].header.ncmds =
456 image_infos[i].header.ncmds = 0;
458 if (mh->
HasKey(
"sizeofcmds"))
459 image_infos[i].header.sizeofcmds =
462 image_infos[i].header.sizeofcmds = 0;
466 uint32_t segcount = segments->
GetSize();
467 for (
size_t j = 0; j < segcount; j++) {
485 if (seg->
HasKey(
"initprot"))
496 if (seg->
HasKey(
"nsects"))
502 image_infos[i].segments.push_back(segment);
505 image_infos[i].uuid.SetFromStringRef(
515 const size_t num_sections = image_infos[i].segments.size();
516 for (
size_t k = 0; k < num_sections; ++k) {
519 if ((image_infos[i].segments[k].fileoff == 0 &&
520 image_infos[i].segments[k].filesize > 0) ||
521 (image_infos[i].segments[k].name ==
"__TEXT")) {
522 image_infos[i].slide =
523 image_infos[i].address - image_infos[i].segments[k].vmaddr;
534 std::vector<std::pair<ImageInfo, ModuleSP>> &images) {
542 const size_t images_size = images.size();
543 for (
size_t i = 0; i < images_size; i++) {
544 const auto &image_info = images[i].first;
545 if (image_info.header.filetype == llvm::MachO::MH_DYLINKER) {
550 if (target_arch.
GetTriple().getEnvironment() == llvm::Triple::Simulator &&
551 image_info.os_type != llvm::Triple::OSType::MacOSX) {
557 if (image_info.header.filetype == llvm::MachO::MH_EXECUTE) {
564 ModuleSP exe_module_sp = images[exe_idx].second;
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 ModuleSP dyld_sp = images[dyld_idx].second;
599 dyld_sp->GetFileSpec().GetPath().c_str());
609 if (image_info.
header.filetype == llvm::MachO::MH_DYLINKER) {
610 const bool can_create =
true;
627 auto log_err = [log](llvm::StringLiteral err_msg) -> std::nullopt_t {
634 return log_err(
"Couldn't retrieve DYLD module. Cannot get `start` symbol.");
637 dyld_sp->FindFirstSymbolWithNameAndType(
ConstString(
"_dyld_start"));
639 return log_err(
"Cannot find `start` symbol in DYLD module.");
655std::vector<std::pair<DynamicLoaderDarwin::ImageInfo, ModuleSP>>
658 const auto size = image_infos.size();
659 std::vector<std::pair<DynamicLoaderDarwin::ImageInfo, ModuleSP>> images(size);
660 auto LoadImage = [&](
size_t i, ImageInfo::collection::const_iterator it) {
661 const auto &image_info = *it;
662 images[i] = std::make_pair(
665 auto it = image_infos.begin();
666 bool is_parallel_load =
668 if (is_parallel_load) {
670 for (
size_t i = 0; i < size; ++i, ++it) {
671 taskGroup.async(LoadImage, i, it);
675 for (
size_t i = 0; i < size; ++i, ++it) {
684 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
690 std::vector<std::pair<ImageInfo, ModuleSP>> &images) {
691 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
698 for (uint32_t idx = 0; idx < images.size(); ++idx) {
699 auto &image_info = images[idx].first;
700 const auto &image_module_sp = images[idx].second;
702 LLDB_LOGF(log,
"Adding new image at address=0x%16.16" PRIx64
".",
704 image_info.PutToLog(log);
708 if (image_module_sp) {
709 ObjectFile *objfile = image_module_sp->GetObjectFile();
716 if (commpage_section) {
718 image_info.GetArchitecture());
722 if (!commpage_image_module_sp) {
728 if (!commpage_image_module_sp ||
729 commpage_image_module_sp->GetObjectFile() ==
nullptr) {
731 image_info.file_spec, image_info.address);
736 bool changed =
false;
761 ArchSpec dyld_spec = image_info.GetArchitecture();
762 auto &dyld_triple = dyld_spec.
GetTriple();
763 if ((dyld_triple.getEnvironment() == llvm::Triple::MacABI &&
764 dyld_triple.getOS() == llvm::Triple::IOS) ||
765 (dyld_triple.getEnvironment() == llvm::Triple::Simulator &&
766 (dyld_triple.getOS() == llvm::Triple::IOS ||
767 dyld_triple.getOS() == llvm::Triple::TvOS ||
768 dyld_triple.getOS() == llvm::Triple::WatchOS)))
769 image_module_sp->MergeArchitecture(dyld_spec);
773 if (loaded_module_list.
GetSize() > 0) {
776 "DynamicLoaderDarwin::ModulesDidLoad");
799 if (module_sp.get() ==
nullptr && sym_ctx.
function) {
803 if (module_sp.get() ==
nullptr)
807 return objc_runtime !=
nullptr &&
816 LLDB_LOGF(log,
"\t\t%16s [0x%16.16" PRIx64
" - 0x%16.16" PRIx64
")",
820 "\t\t%16s [0x%16.16" PRIx64
" - 0x%16.16" PRIx64
821 ") slide = 0x%" PRIx64,
831 if (os_env == llvm::Triple::MacABI && os_type == llvm::Triple::IOS) {
833 "-apple-ios" + min_version_os_sdk +
"-macabi");
838 if (os_env == llvm::Triple::Simulator &&
839 (os_type == llvm::Triple::IOS || os_type == llvm::Triple::TvOS ||
840 os_type == llvm::Triple::WatchOS)) {
842 "-apple-" + llvm::Triple::getOSTypeName(os_type) +
843 min_version_os_sdk +
"-simulator");
853 const size_t num_segments = segments.size();
854 for (
size_t i = 0; i < num_segments; ++i) {
855 if (segments[i].name == name)
866 LLDB_LOG(log,
"uuid={1} path='{2}' (UNLOADED)", uuid.GetAsString(),
867 file_spec.GetPath());
869 LLDB_LOG(log,
"address={0:x+16} uuid={1} path='{2}'", address,
870 uuid.GetAsString(), file_spec.GetPath());
871 for (uint32_t i = 0; i < segments.size(); ++i)
872 segments[i].PutToLog(log, slide);
877 DEBUG_PRINTF(
"DynamicLoaderDarwin::%s() process state = %s\n", __FUNCTION__,
887 DEBUG_PRINTF(
"DynamicLoaderDarwin::%s(%s)\n", __FUNCTION__,
930 if (current_symbol !=
nullptr) {
931 std::vector<Address> addresses;
937 if (trampoline_name) {
938 const ModuleList &images = target_sp->GetImages();
945 context.GetAddressRange(eSymbolContextEverything, 0,
false,
952 LLDB_LOGF(log,
"Found a trampoline target symbol at 0x%" PRIx64
".",
961 if (context.symbol) {
966 if (actual_symbol_addr.
IsValid()) {
967 addresses.push_back(actual_symbol_addr);
972 "Found a re-exported symbol: %s at 0x%" PRIx64
".",
986 context.GetAddressRange(eSymbolContextEverything, 0,
false,
993 LLDB_LOGF(log,
"Found an indirect target symbol at 0x%" PRIx64
".",
1002 const Symbol *actual_symbol =
1004 if (actual_symbol) {
1009 "Found a re-exported symbol: %s pointing to: %s at 0x%" PRIx64
1014 addresses.push_back(target_addr.
GetLoadAddress(target_sp.get()));
1019 if (addresses.size() > 0) {
1022 std::vector<lldb::addr_t> load_addrs;
1023 for (
Address address : addresses) {
1029 &symbol_address,
error);
1030 if (
error.Success()) {
1031 load_addrs.push_back(resolved_addr);
1033 "ResolveIndirectFunction found resolved target for "
1034 "%s at 0x%" PRIx64
".",
1038 load_addrs.push_back(address.GetLoadAddress(target_sp.get()));
1041 thread_plan_sp = std::make_shared<ThreadPlanRunToAddress>(
1042 thread, load_addrs, stop_others);
1045 LLDB_LOGF(log,
"Could not find symbol for step through.");
1048 return thread_plan_sp;
1056 if (!trampoline_name)
1059 static const char *resolver_name_regex =
"(_gc|_non_gc|\\$[A-Za-z0-9\\$]+)$";
1060 std::string equivalent_regex_buf(
"^");
1061 equivalent_regex_buf.append(trampoline_name.
GetCString());
1062 equivalent_regex_buf.append(resolver_name_regex);
1066 equivalent_symbols);
1079 if (module_list.
GetSize() == 1) {
1094 module_sp->FindSymbolsWithNameAndType(
ConstString(
"pthread_getspecific"),
1110 if (!thread_sp || !module_sp)
1113 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1116 if (!module_sp->ResolveFileAddress(tls_file_addr, tls_addr))
1128 auto evaluate_tls_address = [
this, &thread_sp, &clang_void_ptr_type](
1130 llvm::ArrayRef<addr_t> args) ->
addr_t {
1134 *thread_sp, func_ptr, clang_void_ptr_type, args, options));
1139 exe_ctx, thread_plan_sp, options, execution_errors);
1143 thread_plan_sp->GetReturnValueObject()) {
1167 uint8_t buf[
sizeof(
addr_t) * 3];
1169 const size_t tls_data_size = addr_size * 3;
1171 tls_addr, buf, tls_data_size,
error,
true);
1172 if (bytes_read != tls_data_size ||
error.Fail())
1181 if (tls_thunk != 0) {
1186 const addr_t tls_data = evaluate_tls_address(
1187 thunk_load_addr, llvm::ArrayRef<addr_t>(tls_load_addr));
1189 return tls_data + tls_offset;
1201 auto tls_pos = tid_pos->second.find(key);
1202 if (tls_pos != tid_pos->second.end()) {
1203 return tls_pos->second + tls_offset;
1207 if (pthread_getspecific_addr.
IsValid()) {
1208 const addr_t tls_data = evaluate_tls_address(pthread_getspecific_addr,
1209 llvm::ArrayRef<addr_t>(key));
1211 return tls_data + tls_offset;
1219 bool use_new_spi_interface =
false;
1222 if (!version.empty()) {
1223 const llvm::Triple::OSType os_type =
1227 if (os_type == llvm::Triple::MacOSX &&
1228 version >= llvm::VersionTuple(10, 12))
1229 use_new_spi_interface =
true;
1232 if (os_type == llvm::Triple::IOS && version >= llvm::VersionTuple(10))
1233 use_new_spi_interface =
true;
1236 if (os_type == llvm::Triple::TvOS && version >= llvm::VersionTuple(10))
1237 use_new_spi_interface =
true;
1240 if (os_type == llvm::Triple::WatchOS && version >= llvm::VersionTuple(3))
1241 use_new_spi_interface =
true;
1249 if (use_new_spi_interface)
1251 log,
"DynamicLoaderDarwin::UseDYLDSPI: Use new DynamicLoader plugin");
1254 log,
"DynamicLoaderDarwin::UseDYLDSPI: Use old DynamicLoader plugin");
1256 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,...)
#define LLDB_LOGV(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.
A class to manage flag bits.
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report warning events.
static llvm::ThreadPoolInterface & GetThreadPool()
Shared thread pool. Use only with ThreadPoolTaskGroup.
static DynamicLoaderDarwinProperties & GetGlobal()
static llvm::StringRef GetSettingName()
bool GetEnableParallelImageLoad() const
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.
bool UpdateDYLDImageInfoFromNewImageInfo(ImageInfo &image_info)
lldb::ModuleSP GetDYLDModule()
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 PrivateProcessStateChanged(lldb_private::Process *process, lldb::StateType state)
void DidLaunch() override
Called after attaching a process.
lldb::ModuleWP m_dyld_module_wp
static void CreateSettings(lldb_private::Debugger &debugger)
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...
lldb::ModuleSP FindTargetModuleForImageInfo(const ImageInfo &image_info, bool can_create, bool *did_create_ptr)
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.
std::vector< std::pair< ImageInfo, lldb::ModuleSP > > PreloadModulesFromImageInfos(const ImageInfo::collection &image_infos)
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)
std::optional< lldb_private::Address > GetStartAddress() override
Return the start address in the dynamic loader module.
void UpdateSpecialBinariesFromPreloadedModules(std::vector< std::pair< ImageInfo, lldb::ModuleSP > > &images)
void PrivateInitialize(lldb_private::Process *process)
~DynamicLoaderDarwin() override
lldb_private::Address GetPthreadSetSpecificAddress()
void Clear(bool clear_process)
bool AddModulesUsingPreloadedModules(std::vector< std::pair< ImageInfo, lldb::ModuleSP > > &images)
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()
DEPRECATED: Use GetAddressRanges instead.
void PutCString(const char *cstr)
ConstString GetName(NamePreference preference=ePreferDemangled) const
Best name get accessor.
A collection class for Module objects.
std::recursive_mutex & GetMutex() const
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const
bool AppendIfNeeded(const lldb::ModuleSP &new_module, bool notify=true)
Append a module to the module list, if it is not already there.
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.
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.
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
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
static lldb::OptionValuePropertiesSP GetSettingForDynamicLoaderPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForDynamicLoaderPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
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.
lldb::addr_t FixCodeAddress(lldb::addr_t pc)
Some targets might use bits in a code address to indicate a mode switch, ARM uses bit zero to signify...
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.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
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...
virtual 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.
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow)
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.
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
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.
std::shared_ptr< lldb_private::TypeSystemClang > TypeSystemClangSP
std::shared_ptr< lldb_private::Section > SectionSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::Module > ModuleSP
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