LLDB mainline
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
lldb_private::DynamicLoaderDarwin Class Referenceabstract

#include <DynamicLoaderDarwin.h>

Inheritance diagram for lldb_private::DynamicLoaderDarwin:
Inheritance graph
[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
 
- Public Member Functions inherited from lldb_private::DynamicLoader
 DynamicLoader (Process *process)
 Construct with a process.
 
virtual void DidAttach ()=0
 Called after attaching a process.
 
virtual void DidLaunch ()=0
 Called after launching 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 lldb::ThreadPlanSP GetStepThroughTrampolinePlan (Thread &thread, bool stop_others)=0
 Provides a plan to step through the dynamic loader trampoline for the current state of thread.
 
virtual void FindEquivalentSymbols (Symbol *original_symbol, ModuleList &module_list, SymbolContextList &equivalent_symbols)
 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.
 
virtual Status CanLoadImage ()=0
 Ask if it is ok to try and load or unload an shared library (image).
 
virtual bool AlwaysRelyOnEHUnwindInfo (SymbolContext &sym_ctx)
 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 lldb::addr_t GetThreadLocalData (const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr)
 Retrieves the per-module TLS block for a given thread.
 
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.
 
- 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 (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)
 
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.
 
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 189 of file DynamicLoaderDarwin.h.

◆ ThreadIDToTLSMap

Definition at line 190 of file DynamicLoaderDarwin.h.

Constructor & Destructor Documentation

◆ DynamicLoaderDarwin() [1/2]

DynamicLoaderDarwin::DynamicLoaderDarwin ( lldb_private::Process process)

Definition at line 52 of file DynamicLoaderDarwin.cpp.

◆ ~DynamicLoaderDarwin()

DynamicLoaderDarwin::~DynamicLoaderDarwin ( )
overridedefault

◆ DynamicLoaderDarwin() [2/2]

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

Member Function Documentation

◆ AddExecutableModuleIfInImageInfos()

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

◆ AddModulesUsingImageInfos()

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

◆ 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 730 of file DynamicLoaderDarwin.cpp.

References lldb_private::SymbolContext::function, lldb_private::ObjCLanguageRuntime::Get(), lldb_private::Function::GetAddressRange(), lldb_private::Symbol::GetAddressRef(), lldb_private::AddressRange::GetBaseAddress(), 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 621 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 64 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 74 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 987 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()

ModuleSP DynamicLoaderDarwin::FindTargetModuleForImageInfo ( ImageInfo image_info,
bool  can_create,
bool *  did_create_ptr 
)
protected

◆ GetDYLDModule()

ModuleSP DynamicLoaderDarwin::GetDYLDModule ( )
protected

◆ GetMutex()

std::recursive_mutex & lldb_private::DynamicLoaderDarwin::GetMutex ( ) const
inlineprotected

◆ GetPThreadLibraryModule()

lldb::ModuleSP DynamicLoaderDarwin::GetPThreadLibraryModule ( )
protected

◆ GetPthreadSetSpecificAddress()

Address DynamicLoaderDarwin::GetPthreadSetSpecificAddress ( )
protected

◆ GetStepThroughTrampolinePlan()

ThreadPlanSP DynamicLoaderDarwin::GetStepThroughTrampolinePlan ( lldb_private::Thread thread,
bool  stop_others 
)
overridevirtual

◆ GetThreadLocalData()

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

◆ JSONImageInformationIntoImageInfo()

bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo ( lldb_private::StructuredData::ObjectSP  image_details,
ImageInfo::collection image_infos 
)
protected

◆ NeedToDoInitialImageFetch()

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

◆ operator=()

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

◆ PrivateInitialize()

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

◆ PrivateProcessStateChanged()

void DynamicLoaderDarwin::PrivateProcessStateChanged ( lldb_private::Process process,
lldb::StateType  state 
)
protected

◆ SetDYLDModule()

void DynamicLoaderDarwin::SetDYLDModule ( lldb::ModuleSP dyld_module_sp)
protected

◆ SetNotificationBreakpoint()

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

◆ UnloadAllImages()

void DynamicLoaderDarwin::UnloadAllImages ( )
protected

◆ UnloadImages()

void DynamicLoaderDarwin::UnloadImages ( const std::vector< lldb::addr_t > &  solib_addresses)
protected

◆ UnloadModuleSections()

bool DynamicLoaderDarwin::UnloadModuleSections ( lldb_private::Module module,
ImageInfo info 
)
protected

◆ UpdateDYLDImageInfoFromNewImageInfo()

void DynamicLoaderDarwin::UpdateDYLDImageInfoFromNewImageInfo ( ImageInfo image_info)
protected

◆ UpdateImageLoadAddress()

bool DynamicLoaderDarwin::UpdateImageLoadAddress ( lldb_private::Module module,
ImageInfo info 
)
protected

◆ UpdateSpecialBinariesFromNewImageInfos()

void DynamicLoaderDarwin::UpdateSpecialBinariesFromNewImageInfos ( ImageInfo::collection image_infos)
protected

◆ UseDYLDSPI()

bool DynamicLoaderDarwin::UseDYLDSPI ( lldb_private::Process process)
staticprotected

Member Data Documentation

◆ m_dyld

ImageInfo lldb_private::DynamicLoaderDarwin::m_dyld
protected

◆ m_dyld_image_infos

ImageInfo::collection lldb_private::DynamicLoaderDarwin::m_dyld_image_infos
protected

◆ m_dyld_image_infos_stop_id

uint32_t lldb_private::DynamicLoaderDarwin::m_dyld_image_infos_stop_id
protected

◆ m_dyld_module_wp

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

Definition at line 224 of file DynamicLoaderDarwin.h.

Referenced by ClearDYLDModule(), GetDYLDModule(), and SetDYLDModule().

◆ 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 228 of file DynamicLoaderDarwin.h.

Referenced by GetThreadLocalData().


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