LLDB mainline
lldb_private::DynamicLoaderDarwin Class Referenceabstract

#include <DynamicLoaderDarwin.h>

Inheritance diagram for lldb_private::DynamicLoaderDarwin:
[legend]

Classes

struct  ImageInfo
class  Segment

Public Member Functions

 DynamicLoaderDarwin (lldb_private::Process *process)
 ~DynamicLoaderDarwin () override
void DidAttach () override
 Called after attaching a process.
void DidLaunch () 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.
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.
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 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.
virtual void DoInitialImageFetch ()=0
virtual bool NeedToDoInitialImageFetch ()=0
std::optional< lldb_private::AddressGetStartAddress () override
 Return the start address in the dynamic loader module.
Public Member Functions inherited from lldb_private::DynamicLoader
 DynamicLoader (Process *process)
 Construct with a process.
virtual bool ProcessDidExec ()
 Helper function that can be used to detect when a process has called exec and is now a new and different process.
bool GetStopWhenImagesChange () const
 Get whether the process should stop when images change.
void SetStopWhenImagesChange (bool stop)
 Set whether the process should stop when images change.
virtual Status CanLoadImage ()=0
 Ask if it is ok to try and load or unload an shared library (image).
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.
virtual bool GetSharedCacheInformation (lldb::addr_t &base_address, UUID &uuid, LazyBool &using_shared_cache, LazyBool &private_shared_cache)
 Get information about the shared cache for a process, if possible.
virtual bool IsFullyInitialized ()
 Return whether the dynamic loader is fully initialized and it's safe to call its APIs.
virtual void CalculateDynamicSaveCoreRanges (lldb_private::Process &process, std::vector< lldb_private::MemoryRegionInfo > &ranges, llvm::function_ref< bool(const lldb_private::Thread &)> save_thread_predicate)
 Returns a list of memory ranges that should be saved in the core file, specific for this dynamic loader.
Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
virtual ~PluginInterface ()=default
virtual llvm::StringRef GetPluginName ()=0
 PluginInterface (const PluginInterface &)=delete
PluginInterfaceoperator= (const PluginInterface &)=delete

Protected Types

typedef std::map< uint64_t, lldb::addr_tPthreadKeyToTLSMap
typedef std::map< lldb::user_id_t, PthreadKeyToTLSMapThreadIDToTLSMap

Protected Member Functions

void PrivateInitialize (lldb_private::Process *process)
void PrivateProcessStateChanged (lldb_private::Process *process, lldb::StateType state)
void Clear (bool clear_process)
virtual void DoClear ()=0
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 (const ImageInfo &image_info, bool can_create, bool *did_create_ptr)
void UnloadImages (const std::vector< lldb::addr_t > &solib_addresses)
void UnloadAllImages ()
virtual bool SetNotificationBreakpoint ()=0
virtual void ClearNotificationBreakpoint ()=0
virtual bool DidSetNotificationBreakpoint ()=0
std::recursive_mutex & GetMutex () const
lldb::ModuleSP GetPThreadLibraryModule ()
lldb_private::Address GetPthreadSetSpecificAddress ()
bool JSONImageInformationIntoImageInfo (lldb_private::StructuredData::ObjectSP image_details, ImageInfo::collection &image_infos)
std::vector< std::pair< ImageInfo, lldb::ModuleSP > > PreloadModulesFromImageInfos (const ImageInfo::collection &image_infos)
void UpdateSpecialBinariesFromPreloadedModules (std::vector< std::pair< ImageInfo, lldb::ModuleSP > > &images)
bool UpdateDYLDImageInfoFromNewImageInfo (ImageInfo &image_info)
void AddExecutableModuleIfInImageInfos (ImageInfo::collection &image_infos)
bool AddModulesUsingImageInfos (ImageInfo::collection &image_infos)
bool AddModulesUsingPreloadedModules (std::vector< std::pair< ImageInfo, lldb::ModuleSP > > &images)
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.
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.
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.
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 UseDYLDSPI (lldb_private::Process *process)

Protected Attributes

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
Processm_process
 The process that this dynamic loader plug-in is tracking.

Private Member Functions

 DynamicLoaderDarwin (const DynamicLoaderDarwin &)=delete
const DynamicLoaderDarwinoperator= (const DynamicLoaderDarwin &)=delete

Additional Inherited Members

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.
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, bool set_address_in_target, bool allow_memory_image_last_resort)
 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.

Detailed Description

Definition at line 27 of file DynamicLoaderDarwin.h.

Member Typedef Documentation

◆ PthreadKeyToTLSMap

Definition at line 191 of file DynamicLoaderDarwin.h.

◆ ThreadIDToTLSMap

Constructor & Destructor Documentation

◆ DynamicLoaderDarwin() [1/2]

◆ ~DynamicLoaderDarwin()

DynamicLoaderDarwin::~DynamicLoaderDarwin ( )
overridedefault

◆ DynamicLoaderDarwin() [2/2]

lldb_private::DynamicLoaderDarwin::DynamicLoaderDarwin ( const DynamicLoaderDarwin & )
privatedelete

References DynamicLoaderDarwin().

Member Function Documentation

◆ AddExecutableModuleIfInImageInfos()

void lldb_private::DynamicLoaderDarwin::AddExecutableModuleIfInImageInfos ( ImageInfo::collection & image_infos)
protected

◆ AddModulesUsingImageInfos()

bool DynamicLoaderDarwin::AddModulesUsingImageInfos ( ImageInfo::collection & image_infos)
protected

◆ AddModulesUsingPreloadedModules()

◆ AlwaysRelyOnEHUnwindInfo()

bool DynamicLoaderDarwin::AlwaysRelyOnEHUnwindInfo ( lldb_private::SymbolContext & sym_ctx)
overridevirtual

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.

The CFI instructions from the eh_frame section are normally only valid at call sites – places where a program could throw an exception and need to unwind out. But some Modules may be known to the system as having reliable eh_frame information at all call sites. This would be the case if the Module's contents are largely hand-written assembly with hand-written eh_frame information. Normally when unwinding from a function at the beginning of a stack unwind lldb will examine the assembly instructions to understand how the stack frame is set up and where saved registers are stored. But with hand-written assembly this is not reliable enough – we need to consult those function's hand-written eh_frame information.

Returns
True if the symbol context should use eh_frame instructions unconditionally when unwinding from this frame. Else false, the normal lldb unwind behavior of only using eh_frame when the function appears in the middle of the stack.

Reimplemented from lldb_private::DynamicLoader.

Definition at line 790 of file DynamicLoaderDarwin.cpp.

References lldb_private::SymbolContext::function, lldb_private::ObjCLanguageRuntime::Get(), lldb_private::Function::GetAddress(), lldb_private::Symbol::GetAddressRef(), lldb_private::Address::GetModule(), lldb_private::ObjCLanguageRuntime::IsModuleObjCLibrary(), lldb_private::DynamicLoader::m_process, and lldb_private::SymbolContext::symbol.

◆ Clear()

void DynamicLoaderDarwin::Clear ( bool clear_process)
protected

◆ ClearDYLDModule()

void DynamicLoaderDarwin::ClearDYLDModule ( )
protected

Definition at line 649 of file DynamicLoaderDarwin.cpp.

References m_dyld_module_wp.

Referenced by DynamicLoaderMacOS::NotifyBreakpointHit().

◆ ClearNotificationBreakpoint()

virtual void lldb_private::DynamicLoaderDarwin::ClearNotificationBreakpoint ( )
protectedpure virtual

◆ DidAttach()

void DynamicLoaderDarwin::DidAttach ( )
overridevirtual

Called after attaching a process.

Allow DynamicLoader plug-ins to execute some code after attaching to a process.

Implements lldb_private::DynamicLoader.

Definition at line 66 of file DynamicLoaderDarwin.cpp.

References DoInitialImageFetch(), lldb_private::DynamicLoader::m_process, PrivateInitialize(), and SetNotificationBreakpoint().

◆ DidLaunch()

void DynamicLoaderDarwin::DidLaunch ( )
overridevirtual

Called after attaching a process.

Allow DynamicLoader plug-ins to execute some code after attaching to a process.

Implements lldb_private::DynamicLoader.

Definition at line 76 of file DynamicLoaderDarwin.cpp.

References DoInitialImageFetch(), lldb_private::DynamicLoader::m_process, PrivateInitialize(), and SetNotificationBreakpoint().

◆ DidSetNotificationBreakpoint()

virtual bool lldb_private::DynamicLoaderDarwin::DidSetNotificationBreakpoint ( )
protectedpure virtual

◆ DoClear()

virtual void lldb_private::DynamicLoaderDarwin::DoClear ( )
protectedpure virtual

◆ DoInitialImageFetch()

virtual void lldb_private::DynamicLoaderDarwin::DoInitialImageFetch ( )
pure virtual

◆ FindEquivalentSymbols()

void DynamicLoaderDarwin::FindEquivalentSymbols ( lldb_private::Symbol * original_symbol,
lldb_private::ModuleList & module_list,
lldb_private::SymbolContextList & equivalent_symbols )
overridevirtual

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.

If you want to set a breakpoint on one of these symbols, you really need to set it on all the equivalent symbols.

Parameters
[in]original_symbolThe symbol for which we are finding equivalences.
[in]module_listThe set of modules in which to search.
[out]equivalent_symbolsThe equivalent symbol list - any equivalent symbols found are appended to this list.

Reimplemented from lldb_private::DynamicLoader.

Definition at line 1055 of file DynamicLoaderDarwin.cpp.

References lldb_private::Mangled::ePreferMangled, lldb::eSymbolTypeCode, lldb_private::ModuleList::FindSymbolsMatchingRegExAndType(), lldb_private::ConstString::GetCString(), lldb_private::Symbol::GetMangled(), and lldb_private::Mangled::GetName().

◆ FindTargetModuleForImageInfo()

◆ GetDYLDModule()

◆ GetMutex()

◆ GetPThreadLibraryModule()

◆ GetPthreadSetSpecificAddress()

◆ GetStartAddress()

std::optional< lldb_private::Address > DynamicLoaderDarwin::GetStartAddress ( )
overridevirtual

Return the start address in the dynamic loader module.

This is the address the process will begin executing with process launch --stop-at-entry.

Reimplemented from lldb_private::DynamicLoader.

Definition at line 620 of file DynamicLoaderDarwin.cpp.

References lldb_private::DynamicLoader, lldb_private::Symbol::GetAddress(), GetDYLDModule(), lldb_private::GetLog(), and LLDB_LOGV.

◆ GetStepThroughTrampolinePlan()

◆ GetThreadLocalData()

lldb::addr_t DynamicLoaderDarwin::GetThreadLocalData ( const lldb::ModuleSP module,
const lldb::ThreadSP thread,
lldb::addr_t tls_file_addr )
overridevirtual

Retrieves the per-module TLS block for a given thread.

Parameters
[in]moduleThe module to query TLS data for.
[in]threadThe specific thread to query TLS data for.
Returns
If the given thread has TLS data allocated for the module, the address of the TLS block. Otherwise LLDB_INVALID_ADDRESS is returned.

Reimplemented from lldb_private::DynamicLoader.

Definition at line 1111 of file DynamicLoaderDarwin.cpp.

References lldb::eBasicTypeVoid, lldb::eExpressionCompleted, error(), lldb_private::DataExtractor::GetAddress(), lldb_private::ScratchTypeSystemClang::GetForTarget(), lldb_private::Address::GetLoadAddress(), lldb_private::CompilerType::GetPointerType(), GetPthreadSetSpecificAddress(), lldb_private::Address::IsValid(), LLDB_INVALID_ADDRESS, m_mutex, lldb_private::DynamicLoader::m_process, m_tid_to_tls_map, lldb_private::Target::ReadMemory(), and lldb_private::Target::ResolveLoadAddress().

◆ JSONImageInformationIntoImageInfo()

◆ NeedToDoInitialImageFetch()

virtual bool lldb_private::DynamicLoaderDarwin::NeedToDoInitialImageFetch ( )
pure virtual

◆ operator=()

const DynamicLoaderDarwin & lldb_private::DynamicLoaderDarwin::operator= ( const DynamicLoaderDarwin & )
privatedelete

References DynamicLoaderDarwin().

◆ PreloadModulesFromImageInfos()

◆ PrivateInitialize()

void DynamicLoaderDarwin::PrivateInitialize ( lldb_private::Process * process)
protected

◆ PrivateProcessStateChanged()

◆ SetDYLDModule()

◆ SetNotificationBreakpoint()

virtual bool lldb_private::DynamicLoaderDarwin::SetNotificationBreakpoint ( )
protectedpure virtual

◆ UnloadAllImages()

◆ UnloadImages()

◆ UnloadModuleSections()

◆ UpdateDYLDImageInfoFromNewImageInfo()

◆ UpdateImageLoadAddress()

◆ UpdateSpecialBinariesFromPreloadedModules()

◆ UseDYLDSPI()

Member Data Documentation

◆ m_dyld

◆ m_dyld_image_infos

◆ m_dyld_image_infos_stop_id

◆ m_dyld_module_wp

lldb::ModuleWP lldb_private::DynamicLoaderDarwin::m_dyld_module_wp
protected

◆ m_libpthread_module_wp

lldb::ModuleWP lldb_private::DynamicLoaderDarwin::m_libpthread_module_wp
protected

◆ m_mutex

std::recursive_mutex lldb_private::DynamicLoaderDarwin::m_mutex
mutableprotected

◆ m_pthread_getspecific_addr

lldb_private::Address lldb_private::DynamicLoaderDarwin::m_pthread_getspecific_addr
protected

◆ m_tid_to_tls_map

ThreadIDToTLSMap lldb_private::DynamicLoaderDarwin::m_tid_to_tls_map
protected

Definition at line 239 of file DynamicLoaderDarwin.h.

Referenced by DynamicLoaderDarwin(), and GetThreadLocalData().


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