LLDB  mainline
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
DynamicLoaderMacOSXDYLD Class Reference

#include <DynamicLoaderMacOSXDYLD.h>

Inheritance diagram for DynamicLoaderMacOSXDYLD:
Inheritance graph
Collaboration diagram for DynamicLoaderMacOSXDYLD:
Collaboration graph


struct  DYLDAllImageInfos

Public Member Functions

 DynamicLoaderMacOSXDYLD (lldb_private::Process *process)
 ~DynamicLoaderMacOSXDYLD () override
bool ProcessDidExec () override
 Called after attaching a process. More...
lldb_private::Status CanLoadImage () override
 Ask if it is ok to try and load or unload an shared library (image). More...
bool GetSharedCacheInformation (lldb::addr_t &base_address, lldb_private::UUID &uuid, lldb_private::LazyBool &using_shared_cache, lldb_private::LazyBool &private_shared_cache) override
 Get information about the shared cache for a process, if possible. More...
llvm::StringRef GetPluginName () override
bool IsFullyInitialized () override
 Return whether the dynamic loader is fully initialized and it's safe to call its APIs. More...
- Public Member Functions inherited from lldb_private::DynamicLoaderDarwin
 DynamicLoaderDarwin (lldb_private::Process *process)
 ~DynamicLoaderDarwin () override
void DidAttach () override
 Called after attaching a process. More...
void DidLaunch () override
 Called after attaching a process. More...
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. More...
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 symbol one of which will be chosen when the symbol is bound. More...
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. More...
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 first frame in a stack unwind. More...
- Public Member Functions inherited from lldb_private::DynamicLoader
 DynamicLoader (Process *process)
 Construct with a process. More...
bool GetStopWhenImagesChange () const
 Get whether the process should stop when images change. More...
void SetStopWhenImagesChange (bool stop)
 Set whether the process should stop when images change. More...
virtual lldb::ModuleSP LoadModuleAtAddress (const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset)
 Locates or creates a module given by file and updates/loads the resulting module at the virtual base address base_addr. More...
- Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
virtual ~PluginInterface ()=default
 PluginInterface (const PluginInterface &)=delete
PluginInterfaceoperator= (const PluginInterface &)=delete

Static Public Member Functions

static void Initialize ()
static void Terminate ()
static llvm::StringRef GetPluginNameStatic ()
static llvm::StringRef GetPluginDescriptionStatic ()
static lldb_private::DynamicLoaderCreateInstance (lldb_private::Process *process, bool force)
- Static Public Member Functions inherited from lldb_private::DynamicLoader
static DynamicLoaderFindPlugin (Process *process, llvm::StringRef plugin_name)
 Find a dynamic loader plugin for a given process. More...
static lldb::ModuleSP LoadBinaryWithUUIDAndAddress (Process *process, llvm::StringRef name, UUID uuid, lldb::addr_t value, bool value_is_offset, bool force_symbol_search, bool notify)
 Find/load a binary into lldb given a UUID and the address where it is loaded in memory, or a slide to be applied to the file address. More...

Protected Member Functions

void PutToLog (lldb_private::Log *log) const
void DoInitialImageFetch () override
bool NeedToDoInitialImageFetch () override
bool DidSetNotificationBreakpoint () override
void DoClear () override
bool ReadDYLDInfoFromMemoryAndSetNotificationCallback (lldb::addr_t addr)
uint32_t AddrByteSize ()
bool ReadMachHeader (lldb::addr_t addr, llvm::MachO::mach_header *header, lldb_private::DataExtractor *load_command_data)
uint32_t ParseLoadCommands (const lldb_private::DataExtractor &data, ImageInfo &dylib_info, lldb_private::FileSpec *lc_id_dylinker)
bool SetNotificationBreakpoint () override
void ClearNotificationBreakpoint () override
bool InitializeFromAllImageInfos ()
bool ReadAllImageInfosStructure ()
bool AddModulesUsingImageInfosAddress (lldb::addr_t image_infos_addr, uint32_t image_infos_count)
bool RemoveModulesUsingImageInfosAddress (lldb::addr_t image_infos_addr, uint32_t image_infos_count)
void UpdateImageInfosHeaderAndLoadCommands (ImageInfo::collection &image_infos, uint32_t infos_count, bool update_executable)
bool ReadImageInfos (lldb::addr_t image_infos_addr, uint32_t image_infos_count, ImageInfo::collection &image_infos)
- Protected Member Functions inherited from lldb_private::DynamicLoaderDarwin
void PrivateInitialize (lldb_private::Process *process)
void PrivateProcessStateChanged (lldb_private::Process *process, lldb::StateType state)
void Clear (bool clear_process)
void SetDYLDModule (lldb::ModuleSP &dyld_module_sp)
lldb::ModuleSP GetDYLDModule ()
void ClearDYLDModule ()
bool UpdateImageLoadAddress (lldb_private::Module *module, ImageInfo &info)
bool UnloadModuleSections (lldb_private::Module *module, ImageInfo &info)
lldb::ModuleSP FindTargetModuleForImageInfo (ImageInfo &image_info, bool can_create, bool *did_create_ptr)
void UnloadImages (const std::vector< lldb::addr_t > &solib_addresses)
void UnloadAllImages ()
std::recursive_mutex & GetMutex () const
lldb::ModuleSP GetPThreadLibraryModule ()
lldb_private::Address GetPthreadSetSpecificAddress ()
bool JSONImageInformationIntoImageInfo (lldb_private::StructuredData::ObjectSP image_details, ImageInfo::collection &image_infos)
void UpdateSpecialBinariesFromNewImageInfos (ImageInfo::collection &image_infos)
void UpdateDYLDImageInfoFromNewImageInfo (ImageInfo &image_info)
void AddExecutableModuleIfInImageInfos (ImageInfo::collection &image_infos)
bool AddModulesUsingImageInfos (ImageInfo::collection &image_infos)
- Protected Member Functions inherited from lldb_private::DynamicLoader
lldb::ModuleSP FindModuleViaTarget (const FileSpec &file)
lldb::ModuleSP GetTargetExecutable ()
 Checks to see if the target module has changed, updates the target accordingly and returns the target executable module. More...
virtual void UpdateLoadedSections (lldb::ModuleSP module, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset)
 Updates the load address of every allocatable section in module. More...
void UpdateLoadedSectionsCommon (lldb::ModuleSP module, lldb::addr_t base_addr, bool base_addr_is_offset)
virtual void UnloadSections (const lldb::ModuleSP module)
 Removes the loaded sections from the target in module. More...
void UnloadSectionsCommon (const lldb::ModuleSP module)
const lldb_private::SectionListGetSectionListFromModule (const lldb::ModuleSP module) const
int64_t ReadUnsignedIntWithSizeInBytes (lldb::addr_t addr, int size_in_bytes)
lldb::addr_t ReadPointer (lldb::addr_t addr)
void LoadOperatingSystemPlugin (bool flush)

Static Protected Member Functions

static bool NotifyBreakpointHit (void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
static lldb::ByteOrder GetByteOrderFromMagic (uint32_t magic)
- Static Protected Member Functions inherited from lldb_private::DynamicLoaderDarwin
static bool UseDYLDSPI (lldb_private::Process *process)

Protected Attributes

lldb::addr_t m_dyld_all_image_infos_addr
DYLDAllImageInfos m_dyld_all_image_infos
uint32_t m_dyld_all_image_infos_stop_id
lldb::user_id_t m_break_id
std::recursive_mutex m_mutex
bool m_process_image_addr_is_all_images_infos
- Protected Attributes inherited from lldb_private::DynamicLoaderDarwin
lldb::ModuleWP m_dyld_module_wp
lldb::ModuleWP m_libpthread_module_wp
lldb_private::Address m_pthread_getspecific_addr
ThreadIDToTLSMap m_tid_to_tls_map
ImageInfo::collection m_dyld_image_infos
uint32_t m_dyld_image_infos_stop_id
ImageInfo m_dyld
std::recursive_mutex m_mutex
- Protected Attributes inherited from lldb_private::DynamicLoader
 The process that this dynamic loader plug-in is tracking. More...

Private Member Functions

 DynamicLoaderMacOSXDYLD (const DynamicLoaderMacOSXDYLD &)=delete
const DynamicLoaderMacOSXDYLDoperator= (const DynamicLoaderMacOSXDYLD &)=delete

Additional Inherited Members

- Protected Types inherited from lldb_private::DynamicLoaderDarwin
typedef std::map< uint64_t, lldb::addr_tPthreadKeyToTLSMap
typedef std::map< lldb::user_id_t, PthreadKeyToTLSMapThreadIDToTLSMap

Detailed Description

Definition at line 35 of file DynamicLoaderMacOSXDYLD.h.

Constructor & Destructor Documentation

◆ DynamicLoaderMacOSXDYLD() [1/2]

DynamicLoaderMacOSXDYLD::DynamicLoaderMacOSXDYLD ( lldb_private::Process process)

Definition at line 98 of file DynamicLoaderMacOSXDYLD.cpp.

◆ ~DynamicLoaderMacOSXDYLD()

DynamicLoaderMacOSXDYLD::~DynamicLoaderMacOSXDYLD ( )

◆ DynamicLoaderMacOSXDYLD() [2/2]

DynamicLoaderMacOSXDYLD::DynamicLoaderMacOSXDYLD ( const DynamicLoaderMacOSXDYLD )

Member Function Documentation

◆ AddModulesUsingImageInfosAddress()

bool DynamicLoaderMacOSXDYLD::AddModulesUsingImageInfosAddress ( lldb::addr_t  image_infos_addr,
uint32_t  image_infos_count 

◆ AddrByteSize()

uint32_t DynamicLoaderMacOSXDYLD::AddrByteSize ( )

◆ CanLoadImage()

Status DynamicLoaderMacOSXDYLD::CanLoadImage ( )

Ask if it is ok to try and load or unload an shared library (image).

The dynamic loader often knows when it would be ok to try and load or unload a shared library. This function call allows the dynamic loader plug-ins to check any current dyld state to make sure it is an ok time to load a shared library.

true if it is currently ok to try and load a shared library into the process, false otherwise.

Implements lldb_private::DynamicLoader.

Definition at line 1038 of file DynamicLoaderMacOSXDYLD.cpp.

References DynamicLoaderMacOSXDYLD::DYLDAllImageInfos::dylib_info_addr, error(), m_dyld_all_image_infos, and ReadAllImageInfosStructure().

◆ ClearNotificationBreakpoint()

void DynamicLoaderMacOSXDYLD::ClearNotificationBreakpoint ( )

◆ CreateInstance()

DynamicLoader * DynamicLoaderMacOSXDYLD::CreateInstance ( lldb_private::Process process,
bool  force 

◆ DidSetNotificationBreakpoint()

bool DynamicLoaderMacOSXDYLD::DidSetNotificationBreakpoint ( )

◆ DoClear()

void DynamicLoaderMacOSXDYLD::DoClear ( )

◆ DoInitialImageFetch()

void DynamicLoaderMacOSXDYLD::DoInitialImageFetch ( )

◆ GetByteOrderFromMagic()

lldb::ByteOrder DynamicLoaderMacOSXDYLD::GetByteOrderFromMagic ( uint32_t  magic)

◆ GetPluginDescriptionStatic()

llvm::StringRef DynamicLoaderMacOSXDYLD::GetPluginDescriptionStatic ( )

Definition at line 1145 of file DynamicLoaderMacOSXDYLD.cpp.

Referenced by Initialize().

◆ GetPluginName()

llvm::StringRef DynamicLoaderMacOSXDYLD::GetPluginName ( )

Implements lldb_private::PluginInterface.

Definition at line 67 of file DynamicLoaderMacOSXDYLD.h.

References GetPluginNameStatic().

◆ GetPluginNameStatic()

static llvm::StringRef DynamicLoaderMacOSXDYLD::GetPluginNameStatic ( )

◆ GetSharedCacheInformation()

bool DynamicLoaderMacOSXDYLD::GetSharedCacheInformation ( lldb::addr_t base_address,
lldb_private::UUID uuid,
lldb_private::LazyBool using_shared_cache,
lldb_private::LazyBool private_shared_cache 

Get information about the shared cache for a process, if possible.

On some systems (e.g. Darwin based systems), a set of libraries that are common to most processes may be put in a single region of memory and mapped into every process, this is called the shared cache, as a performance optimization.

Many targets will not have the concept of a shared cache.

Depending on how the DynamicLoader gathers information about the shared cache, it may be able to only return basic information - like the UUID of the cache - or it may be able to return additional information about the cache.

[out]base_addressThe base address (load address) of the shared cache. LLDB_INVALID_ADDRESS if it cannot be determined.
[out]uuidThe UUID of the shared cache, if it can be determined. If the UUID cannot be fetched, IsValid() will be false.
[out]using_shared_cacheIf this process is using a shared cache. If unknown, eLazyBoolCalculate is returned.
[out]private_shared_cacheA LazyBool indicating whether this process is using a private shared cache. If this information cannot be fetched, eLazyBoolCalculate.
Returns false if this DynamicLoader cannot gather information about the shared cache / has no concept of a shared cache.

Reimplemented from lldb_private::DynamicLoader.

Definition at line 1056 of file DynamicLoaderMacOSXDYLD.cpp.

References lldb_private::UUID::Clear(), lldb_private::eLazyBoolCalculate, lldb_private::eLazyBoolYes, error(), lldb_private::Process::GetAddressByteSize(), lldb_private::Process::GetImageInfoAddress(), lldb_private::UUID::IsValid(), LLDB_INVALID_ADDRESS, lldb_private::DynamicLoader::m_process, lldb_private::Process::ReadMemory(), and lldb_private::Process::ReadUnsignedIntegerFromMemory().

◆ Initialize()

void DynamicLoaderMacOSXDYLD::Initialize ( )

◆ InitializeFromAllImageInfos()

bool DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos ( )

◆ IsFullyInitialized()

bool DynamicLoaderMacOSXDYLD::IsFullyInitialized ( )

Return whether the dynamic loader is fully initialized and it's safe to call its APIs.

On some systems (e.g. Darwin based systems), lldb will get notified by the dynamic loader before it itself finished initializing and it's not safe to call certain APIs or SPIs.

Reimplemented from lldb_private::DynamicLoader.

Definition at line 1128 of file DynamicLoaderMacOSXDYLD.cpp.

References DynamicLoaderMacOSXDYLD::DYLDAllImageInfos::libSystemInitialized, m_dyld_all_image_infos, and ReadAllImageInfosStructure().

◆ NeedToDoInitialImageFetch()

bool DynamicLoaderMacOSXDYLD::NeedToDoInitialImageFetch ( )

◆ NotifyBreakpointHit()

bool DynamicLoaderMacOSXDYLD::NotifyBreakpointHit ( void *  baton,
lldb_private::StoppointCallbackContext context,
lldb::user_id_t  break_id,
lldb::user_id_t  break_loc_id 

◆ operator=()

const DynamicLoaderMacOSXDYLD& DynamicLoaderMacOSXDYLD::operator= ( const DynamicLoaderMacOSXDYLD )

◆ ParseLoadCommands()

uint32_t DynamicLoaderMacOSXDYLD::ParseLoadCommands ( const lldb_private::DataExtractor data,
ImageInfo dylib_info,
lldb_private::FileSpec lc_id_dylinker 

◆ ProcessDidExec()

bool DynamicLoaderMacOSXDYLD::ProcessDidExec ( )

◆ PutToLog()

void DynamicLoaderMacOSXDYLD::PutToLog ( lldb_private::Log log) const

◆ ReadAllImageInfosStructure()

bool DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure ( )

◆ ReadDYLDInfoFromMemoryAndSetNotificationCallback()

bool DynamicLoaderMacOSXDYLD::ReadDYLDInfoFromMemoryAndSetNotificationCallback ( lldb::addr_t  addr)

◆ ReadImageInfos()

bool DynamicLoaderMacOSXDYLD::ReadImageInfos ( lldb::addr_t  image_infos_addr,
uint32_t  image_infos_count,
ImageInfo::collection image_infos 

◆ ReadMachHeader()

bool DynamicLoaderMacOSXDYLD::ReadMachHeader ( lldb::addr_t  addr,
llvm::MachO::mach_header *  header,
lldb_private::DataExtractor load_command_data 

◆ RemoveModulesUsingImageInfosAddress()

bool DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress ( lldb::addr_t  image_infos_addr,
uint32_t  image_infos_count 

◆ SetNotificationBreakpoint()

bool DynamicLoaderMacOSXDYLD::SetNotificationBreakpoint ( )

◆ Terminate()

void DynamicLoaderMacOSXDYLD::Terminate ( )

◆ UpdateImageInfosHeaderAndLoadCommands()

void DynamicLoaderMacOSXDYLD::UpdateImageInfosHeaderAndLoadCommands ( ImageInfo::collection image_infos,
uint32_t  infos_count,
bool  update_executable 

Member Data Documentation

◆ m_break_id

lldb::user_id_t DynamicLoaderMacOSXDYLD::m_break_id

◆ m_dyld_all_image_infos

DYLDAllImageInfos DynamicLoaderMacOSXDYLD::m_dyld_all_image_infos

◆ m_dyld_all_image_infos_addr

lldb::addr_t DynamicLoaderMacOSXDYLD::m_dyld_all_image_infos_addr

◆ m_dyld_all_image_infos_stop_id

uint32_t DynamicLoaderMacOSXDYLD::m_dyld_all_image_infos_stop_id

Definition at line 161 of file DynamicLoaderMacOSXDYLD.h.

Referenced by ReadAllImageInfosStructure().

◆ m_mutex

std::recursive_mutex DynamicLoaderMacOSXDYLD::m_mutex

◆ m_process_image_addr_is_all_images_infos

bool DynamicLoaderMacOSXDYLD::m_process_image_addr_is_all_images_infos

Definition at line 164 of file DynamicLoaderMacOSXDYLD.h.

Referenced by DoInitialImageFetch(), and ProcessDidExec().

The documentation for this class was generated from the following files: