202 m_process->GetLoadedDynamicLibrariesInfos(
204 ImageInfo::collection image_infos;
205 if (all_image_info_json_sp.get() &&
206 all_image_info_json_sp->GetAsDictionary() &&
207 all_image_info_json_sp->GetAsDictionary()->HasKey(
"images") &&
208 all_image_info_json_sp->GetAsDictionary()
209 ->GetValueForKey(
"images")
218 ->GetValueForKey(
"images")
221 images->
GetItemAtIndex(0)->GetAsDictionary()->HasKey(
"mach_header")) {
224 LLDB_LOGF(log,
"Initial module fetch: Adding %" PRIu64
" modules.\n",
225 (uint64_t)image_infos.size());
236 size_t image_count = images->
GetSize();
237 std::vector<addr_t> load_addresses;
238 for (
size_t i = 0; i < image_count; i++) {
241 if (image && image->
HasKey(
"load_address")) {
245 load_addresses.push_back(val);
327 argument_values.
PushValue(headers_value);
330 if (abi->GetArgumentValues(thread, argument_values)) {
333 if (dyld_mode !=
static_cast<uint32_t
>(-1)) {
336 uint32_t image_infos_count =
338 if (image_infos_count !=
static_cast<uint32_t
>(-1)) {
341 if (header_array !=
static_cast<uint64_t
>(-1)) {
342 std::vector<addr_t> image_load_addresses;
355 image_load_addresses = thread.FetchNewlyAddedBinaries();
357 if (image_load_addresses.size() != image_infos_count) {
358 image_load_addresses.clear();
364 addrsize * 3 * image_infos_count, 0);
366 if (process->
ReadMemory(header_array, buffer_sp->GetBytes(),
367 buffer_sp->GetByteSize(),
368 read_error) == buffer_sp->GetByteSize() &&
374 for (uint64_t i = 0; i < image_infos_count; i++) {
376 image_load_addresses.push_back(addr);
377 offset += 2 * addrsize;
382 "DynamicLoaderMacOS::NotifyBreakpointHit unable "
383 "to read binary mach-o load address at 0x%" PRIx64,
386 if (dyld_mode == 0) {
403 thread.FetchDetailedBinariesInfo());
405 }
else if (dyld_mode == 1) {
408 }
else if (dyld_mode == 2) {
411 }
else if (dyld_mode == 3 && image_infos_count == 1) {
423 addr_t notification_location = all_image_infos + 4 +
427 addr_t notification_addr =
429 if (!
error.Success()) {
431 "DynamicLoaderMacOS::NotifyBreakpointHit unable "
432 "to read address of dyld-handover notification function at "
434 notification_location);
447 "no ABI plugin located for triple " +
449 ": shared libraries will not be registered",
472 const std::vector<lldb::addr_t> &load_addresses,
475 ImageInfo::collection image_infos;
476 if (load_addresses.empty())
495 const size_t image_fetch_max = 600;
497 size_t total_image_size = load_addresses.size();
498 while (fetched < total_image_size) {
499 size_t this_fetch_amt =
500 std::min(image_fetch_max, total_image_size - fetched);
501 std::vector<addr_t> fetch_binaries(load_addresses.begin() + fetched,
502 load_addresses.begin() + fetched +
505 LLDB_LOGF(log,
"Adding %" PRId64
" modules.",
506 (uint64_t)fetch_binaries.size());
518 fetched += this_fetch_amt;
bool GetSharedCacheInformation(lldb::addr_t &base_address, lldb_private::UUID &uuid, lldb_private::LazyBool &using_shared_cache, lldb_private::LazyBool &private_shared_cache, lldb_private::FileSpec &shared_cache_path, std::optional< uint64_t > &size) override
Get information about the shared cache for a process, if possible.
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *>
Report warning events.
lldb::ModuleSP GetDYLDModule()
DynamicLoaderDarwin(lldb_private::Process *process)
uint32_t m_dyld_image_infos_stop_id
std::recursive_mutex & GetMutex() const
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)
void UpdateSpecialBinariesFromPreloadedModules(std::vector< std::pair< ImageInfo, lldb::ModuleSP > > &images)
bool AddModulesUsingPreloadedModules(std::vector< std::pair< ImageInfo, lldb::ModuleSP > > &images)
static bool UseDYLDSPI(lldb_private::Process *process)
lldb_private::Address m_pthread_getspecific_addr
void UnloadImages(const std::vector< lldb::addr_t > &solib_addresses)
Process * m_process
The process that this dynamic loader plug-in is tracking.
bool GetStopWhenImagesChange() const
Get whether the process should stop when images change.
DynamicLoader(Process *process)
Construct with a process.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Process * GetProcessPtr() const
Returns a pointer to the process object.
Thread & GetThreadRef() const
Returns a reference to the thread object.
void Append(const FileSpec &file)
Append a FileSpec object to the list.
void SetPath(llvm::StringRef p)
Temporary helper for FileSystem change.
A collection class for Module objects.
ModuleIterableNoLocking ModulesNoLocking() const
std::recursive_mutex & GetMutex() const
void Clear()
Clear the object's state.
ModuleIterable Modules() const
size_t GetSize() const
Gets the size of the module list.
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.
Symtab * GetSymtab(bool can_create=true)
Get the module's symbol table.
A plug-in interface definition class for object file parsers.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
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.
virtual lldb::addr_t GetImageInfoAddress()
Get the image information address for the current process.
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
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 GetStopID() const
const lldb::ABISP & GetABI()
Target & GetTarget()
Get the target object pointer for this module.
unsigned int UInt(unsigned int fail_value=0) const
unsigned long long ULongLong(unsigned long long fail_value=0) const
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.
static Status FromErrorString(const char *str)
bool Success() const
Test for success condition.
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
ExecutionContextRef exe_ctx_ref
lldb::break_id_t GetID() const
ObjectSP GetItemAtIndex(size_t idx) const
ObjectSP GetValueForKey(llvm::StringRef key) const
bool HasKey(llvm::StringRef key) const
std::shared_ptr< Object > ObjectSP
Defines a symbol context baton that can be handed other debug core functions.
bool ValueIsAddress() const
Address & GetAddressRef()
ConstString GetName() const
Module * GetExecutableModulePointer()
Debugger & GetDebugger() const
void ClearSectionLoadList()
const ModuleList & GetImages() const
Get accessor for the images for this process.
const ArchSpec & GetArchitecture() const
Represents UUID's of various sizes.
bool SetFromStringRef(llvm::StringRef str)
void PushValue(const Value &value)
Value * GetValueAtIndex(size_t idx)
const Scalar & GetScalar() const
See comment on m_scalar to understand what GetScalar returns.
@ Scalar
A raw scalar value.
void SetCompilerType(const CompilerType &compiler_type)
void SetValueType(ValueType value_type)
#define LLDB_INVALID_BREAK_ID
#define LLDB_BREAK_ID_IS_VALID(bid)
#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.
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::Thread > ThreadSP
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
@ eEncodingUint
unsigned integer
std::shared_ptr< lldb_private::TypeSystemClang > TypeSystemClangSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
@ eBinaryInformationLevelFull
@ eBinaryInformationLevelAddrOnly
std::shared_ptr< lldb_private::Module > ModuleSP
lldb::user_id_t GetID() const
Get accessor for the user ID.