LLDB  mainline
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
DYLDRendezvous Class Reference

#include <DYLDRendezvous.h>

Collaboration diagram for DYLDRendezvous:
Collaboration graph
[legend]

Classes

struct  Rendezvous
 
struct  SOEntry
 Structure representing the shared objects currently loaded into the inferior process. More...
 
struct  ThreadInfo
 

Public Types

enum  RendezvousState { eConsistent, eAdd, eDelete }
 Constants describing the state of the rendezvous. More...
 
typedef SOEntryList::const_iterator iterator
 

Public Member Functions

 DYLDRendezvous (lldb_private::Process *process)
 
void UpdateExecutablePath ()
 Update the cached executable path. More...
 
bool Resolve ()
 Update the internal snapshot of runtime linker rendezvous and recompute the currently loaded modules. More...
 
bool IsValid ()
 
lldb::addr_t GetRendezvousAddress () const
 
uint64_t GetVersion () const
 
lldb::addr_t GetLinkMapAddress () const
 
lldb::addr_t GetBreakAddress () const
 A breakpoint should be set at this address and Resolve called on each hit. More...
 
uint64_t GetState () const
 Returns the current state of the rendezvous structure. More...
 
lldb::addr_t GetLDBase () const
 
const ThreadInfoGetThreadInfo ()
 
bool ModulesDidLoad () const
 
bool ModulesDidUnload () const
 
void DumpToLog (lldb_private::Log *log) const
 
iterator begin () const
 Iterators over all currently loaded modules. More...
 
iterator end () const
 
iterator loaded_begin () const
 Iterators over all modules loaded into the inferior since the last call to Resolve(). More...
 
iterator loaded_end () const
 
iterator unloaded_begin () const
 Iterators over all modules unloaded from the inferior since the last call to Resolve(). More...
 
iterator unloaded_end () const
 

Protected Types

enum  PThreadField { eSize, eNElem, eOffset }
 
enum  RendezvousAction { eNoAction, eTakeSnapshot, eAddModules, eRemoveModules }
 
typedef std::list< SOEntrySOEntryList
 

Protected Member Functions

lldb::addr_t ReadWord (lldb::addr_t addr, uint64_t *dst, size_t size)
 Reads an unsigned integer of size bytes from the inferior's address space starting at addr. More...
 
lldb::addr_t ReadPointer (lldb::addr_t addr, lldb::addr_t *dst)
 Reads an address from the inferior's address space starting at addr. More...
 
std::string ReadStringFromMemory (lldb::addr_t addr)
 Reads a null-terminated C string from the memory location starting at addr. More...
 
bool ReadSOEntryFromMemory (lldb::addr_t addr, SOEntry &entry)
 Reads an SOEntry starting at addr. More...
 
bool UpdateSOEntries ()
 Updates the current set of SOEntries, the set of added entries, and the set of removed entries. More...
 
bool UpdateSOEntriesFromRemote ()
 Same as UpdateSOEntries but it gets the list of loaded modules from the remote debug server (faster when supported). More...
 
bool FillSOEntryFromModuleInfo (LoadedModuleInfoList::LoadedModuleInfo const &modInfo, SOEntry &entry)
 
bool SaveSOEntriesFromRemote (const LoadedModuleInfoList &module_list)
 
bool AddSOEntriesFromRemote (const LoadedModuleInfoList &module_list)
 
bool RemoveSOEntriesFromRemote (const LoadedModuleInfoList &module_list)
 
bool AddSOEntries ()
 
bool RemoveSOEntries ()
 
void UpdateBaseAddrIfNecessary (SOEntry &entry, std::string const &file_path)
 
bool SOEntryIsMainExecutable (const SOEntry &entry)
 
bool TakeSnapshot (SOEntryList &entry_list)
 Reads the current list of shared objects according to the link map supplied by the runtime linker. More...
 
bool FindMetadata (const char *name, PThreadField field, uint32_t &value)
 
RendezvousAction GetAction () const
 Returns the current action to be taken given the current and previous state. More...
 

Protected Attributes

lldb_private::Processm_process
 
lldb_private::FileSpec m_exe_file_spec
 
lldb::addr_t m_rendezvous_addr
 Location of the r_debug structure in the inferiors address space. More...
 
Rendezvous m_current
 Current and previous snapshots of the rendezvous structure. More...
 
Rendezvous m_previous
 
LoadedModuleInfoList m_loaded_modules
 List of currently loaded SO modules. More...
 
SOEntryList m_soentries
 List of SOEntry objects corresponding to the current link map state. More...
 
SOEntryList m_added_soentries
 List of SOEntry's added to the link map since the last call to Resolve(). More...
 
SOEntryList m_removed_soentries
 List of SOEntry's removed from the link map since the last call to Resolve(). More...
 
ThreadInfo m_thread_info
 Threading metadata read from the inferior. More...
 

Detailed Description

Interface to the runtime linker.

A structure is present in a processes memory space which is updated by the runtime liker each time a module is loaded or unloaded. This class provides an interface to this structure and maintains a consistent snapshot of the currently loaded modules.

Definition at line 34 of file DYLDRendezvous.h.

Member Typedef Documentation

◆ iterator

typedef SOEntryList::const_iterator DYLDRendezvous::iterator

Definition at line 161 of file DYLDRendezvous.h.

◆ SOEntryList

typedef std::list<SOEntry> DYLDRendezvous::SOEntryList
protected

Definition at line 158 of file DYLDRendezvous.h.

Member Enumeration Documentation

◆ PThreadField

Enumerator
eSize 
eNElem 
eOffset 

Definition at line 255 of file DYLDRendezvous.h.

◆ RendezvousAction

Enumerator
eNoAction 
eTakeSnapshot 
eAddModules 
eRemoveModules 

Definition at line 259 of file DYLDRendezvous.h.

◆ RendezvousState

Constants describing the state of the rendezvous.

See also
GetState().
Enumerator
eConsistent 
eAdd 
eDelete 

Definition at line 124 of file DYLDRendezvous.h.

Constructor & Destructor Documentation

◆ DYLDRendezvous()

DYLDRendezvous::DYLDRendezvous ( lldb_private::Process process)

Member Function Documentation

◆ AddSOEntries()

bool DYLDRendezvous::AddSOEntries ( )
protected

◆ AddSOEntriesFromRemote()

bool DYLDRendezvous::AddSOEntriesFromRemote ( const LoadedModuleInfoList module_list)
protected

◆ begin()

iterator DYLDRendezvous::begin ( ) const
inline

Iterators over all currently loaded modules.

Definition at line 164 of file DYLDRendezvous.h.

References m_soentries.

Referenced by DumpToLog(), DynamicLoaderPOSIXDYLD::LoadAllCurrentModules(), DynamicLoaderPOSIXDYLD::RefreshModules(), and RemoveSOEntries().

◆ DumpToLog()

void DYLDRendezvous::DumpToLog ( lldb_private::Log log) const

◆ end()

iterator DYLDRendezvous::end ( ) const
inline

◆ FillSOEntryFromModuleInfo()

bool DYLDRendezvous::FillSOEntryFromModuleInfo ( LoadedModuleInfoList::LoadedModuleInfo const &  modInfo,
SOEntry entry 
)
protected

◆ FindMetadata()

bool DYLDRendezvous::FindMetadata ( const char *  name,
PThreadField  field,
uint32_t value 
)
protected

◆ GetAction()

DYLDRendezvous::RendezvousAction DYLDRendezvous::GetAction ( ) const
protected

Returns the current action to be taken given the current and previous state.

Definition at line 177 of file DYLDRendezvous.cpp.

References eAdd, eAddModules, eConsistent, eDelete, eNoAction, eRemoveModules, eTakeSnapshot, m_current, m_previous, and DYLDRendezvous::Rendezvous::state.

Referenced by UpdateSOEntries(), and UpdateSOEntriesFromRemote().

◆ GetBreakAddress()

lldb::addr_t DYLDRendezvous::GetBreakAddress ( ) const
inline

A breakpoint should be set at this address and Resolve called on each hit.

Returns
the address of a function called by the runtime linker each time a module is loaded/unloaded, or about to be loaded/unloaded.
See also
Resolve()

Definition at line 99 of file DYLDRendezvous.h.

References DYLDRendezvous::Rendezvous::brk, and m_current.

Referenced by DumpToLog(), and DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint().

◆ GetLDBase()

lldb::addr_t DYLDRendezvous::GetLDBase ( ) const
inline
Returns
the base address of the runtime linker in the inferiors address space.

Definition at line 106 of file DYLDRendezvous.h.

References DYLDRendezvous::Rendezvous::ldbase, and m_current.

Referenced by DumpToLog().

◆ GetLinkMapAddress()

lldb::addr_t DYLDRendezvous::GetLinkMapAddress ( ) const
inline
Returns
address in the inferiors address space containing the linked list of shared object descriptors.

Definition at line 90 of file DYLDRendezvous.h.

References m_current, and DYLDRendezvous::Rendezvous::map_addr.

Referenced by DumpToLog(), and DynamicLoaderPOSIXDYLD::LoadAllCurrentModules().

◆ GetRendezvousAddress()

lldb::addr_t DYLDRendezvous::GetRendezvousAddress ( ) const
inline
Returns
the address of the rendezvous structure in the inferiors address space.

Definition at line 83 of file DYLDRendezvous.h.

References m_rendezvous_addr.

Referenced by DumpToLog().

◆ GetState()

uint64_t DYLDRendezvous::GetState ( ) const
inline

Returns the current state of the rendezvous structure.

Definition at line 102 of file DYLDRendezvous.h.

References m_current, and DYLDRendezvous::Rendezvous::state.

Referenced by DumpToLog().

◆ GetThreadInfo()

const DYLDRendezvous::ThreadInfo & DYLDRendezvous::GetThreadInfo ( )

◆ GetVersion()

uint64_t DYLDRendezvous::GetVersion ( ) const
inline
Returns
the version of the rendezvous protocol being used.

Definition at line 86 of file DYLDRendezvous.h.

References m_current, and DYLDRendezvous::Rendezvous::version.

Referenced by DumpToLog().

◆ IsValid()

bool DYLDRendezvous::IsValid ( )
Returns
true if this rendezvous has been located in the inferiors address space and false otherwise.

Definition at line 173 of file DYLDRendezvous.cpp.

References LLDB_INVALID_ADDRESS, and m_rendezvous_addr.

Referenced by DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint().

◆ loaded_begin()

iterator DYLDRendezvous::loaded_begin ( ) const
inline

Iterators over all modules loaded into the inferior since the last call to Resolve().

Definition at line 169 of file DYLDRendezvous.h.

References m_added_soentries.

Referenced by DynamicLoaderPOSIXDYLD::RefreshModules().

◆ loaded_end()

iterator DYLDRendezvous::loaded_end ( ) const
inline

Definition at line 170 of file DYLDRendezvous.h.

References m_added_soentries.

Referenced by DynamicLoaderPOSIXDYLD::RefreshModules().

◆ ModulesDidLoad()

bool DYLDRendezvous::ModulesDidLoad ( ) const
inline
Returns
true if modules have been loaded into the inferior since the last call to Resolve().

Definition at line 113 of file DYLDRendezvous.h.

References m_added_soentries.

Referenced by DynamicLoaderPOSIXDYLD::RefreshModules().

◆ ModulesDidUnload()

bool DYLDRendezvous::ModulesDidUnload ( ) const
inline
Returns
true if modules have been unloaded from the inferior since the last call to Resolve().

Definition at line 117 of file DYLDRendezvous.h.

References m_removed_soentries.

Referenced by DynamicLoaderPOSIXDYLD::RefreshModules().

◆ ReadPointer()

addr_t DYLDRendezvous::ReadPointer ( lldb::addr_t  addr,
lldb::addr_t dst 
)
protected

Reads an address from the inferior's address space starting at addr.

Returns
addr + target address size if the read was successful and 0 otherwise.

Definition at line 466 of file DYLDRendezvous.cpp.

References error(), lldb_private::Process::GetAddressByteSize(), m_process, and lldb_private::Process::ReadPointerFromMemory().

Referenced by ReadSOEntryFromMemory(), and Resolve().

◆ ReadSOEntryFromMemory()

bool DYLDRendezvous::ReadSOEntryFromMemory ( lldb::addr_t  addr,
SOEntry entry 
)
protected

◆ ReadStringFromMemory()

std::string DYLDRendezvous::ReadStringFromMemory ( lldb::addr_t  addr)
protected

Reads a null-terminated C string from the memory location starting at addr.

Definition at line 476 of file DYLDRendezvous.cpp.

References error(), LLDB_INVALID_ADDRESS, m_process, lldb_private::Process::ReadCStringFromMemory(), and string().

Referenced by ReadSOEntryFromMemory().

◆ ReadWord()

addr_t DYLDRendezvous::ReadWord ( lldb::addr_t  addr,
uint64_t *  dst,
size_t  size 
)
protected

Reads an unsigned integer of size bytes from the inferior's address space starting at addr.

Returns
addr + size if the read was successful and false otherwise.

Definition at line 456 of file DYLDRendezvous.cpp.

References error(), m_process, and lldb_private::Process::ReadUnsignedIntegerFromMemory().

Referenced by Resolve().

◆ RemoveSOEntries()

bool DYLDRendezvous::RemoveSOEntries ( )
protected

◆ RemoveSOEntriesFromRemote()

bool DYLDRendezvous::RemoveSOEntriesFromRemote ( const LoadedModuleInfoList module_list)
protected

◆ Resolve()

bool DYLDRendezvous::Resolve ( )

◆ SaveSOEntriesFromRemote()

bool DYLDRendezvous::SaveSOEntriesFromRemote ( const LoadedModuleInfoList module_list)
protected

◆ SOEntryIsMainExecutable()

bool DYLDRendezvous::SOEntryIsMainExecutable ( const SOEntry entry)
protected

◆ TakeSnapshot()

bool DYLDRendezvous::TakeSnapshot ( SOEntryList entry_list)
protected

Reads the current list of shared objects according to the link map supplied by the runtime linker.

Definition at line 433 of file DYLDRendezvous.cpp.

References DYLDRendezvous::SOEntry::clear(), m_current, DYLDRendezvous::Rendezvous::map_addr, DYLDRendezvous::SOEntry::next, ReadSOEntryFromMemory(), and SOEntryIsMainExecutable().

Referenced by RemoveSOEntries(), and UpdateSOEntries().

◆ unloaded_begin()

iterator DYLDRendezvous::unloaded_begin ( ) const
inline

Iterators over all modules unloaded from the inferior since the last call to Resolve().

Definition at line 174 of file DYLDRendezvous.h.

References m_removed_soentries.

Referenced by DynamicLoaderPOSIXDYLD::RefreshModules().

◆ unloaded_end()

iterator DYLDRendezvous::unloaded_end ( ) const
inline

Definition at line 175 of file DYLDRendezvous.h.

References m_removed_soentries.

Referenced by DynamicLoaderPOSIXDYLD::RefreshModules().

◆ UpdateBaseAddrIfNecessary()

void DYLDRendezvous::UpdateBaseAddrIfNecessary ( SOEntry entry,
std::string const &  file_path 
)
protected

◆ UpdateExecutablePath()

void DYLDRendezvous::UpdateExecutablePath ( )

◆ UpdateSOEntries()

bool DYLDRendezvous::UpdateSOEntries ( )
protected

Updates the current set of SOEntries, the set of added entries, and the set of removed entries.

Definition at line 247 of file DYLDRendezvous.cpp.

References AddSOEntries(), eAddModules, eNoAction, eRemoveModules, eTakeSnapshot, GetAction(), m_added_soentries, m_removed_soentries, m_soentries, RemoveSOEntries(), and TakeSnapshot().

Referenced by Resolve().

◆ UpdateSOEntriesFromRemote()

bool DYLDRendezvous::UpdateSOEntriesFromRemote ( )
protected

Member Data Documentation

◆ m_added_soentries

SOEntryList DYLDRendezvous::m_added_soentries
protected

List of SOEntry's added to the link map since the last call to Resolve().

Definition at line 198 of file DYLDRendezvous.h.

Referenced by AddSOEntries(), AddSOEntriesFromRemote(), loaded_begin(), loaded_end(), ModulesDidLoad(), UpdateSOEntries(), and UpdateSOEntriesFromRemote().

◆ m_current

Rendezvous DYLDRendezvous::m_current
protected

Current and previous snapshots of the rendezvous structure.

Definition at line 187 of file DYLDRendezvous.h.

Referenced by AddSOEntries(), GetAction(), GetBreakAddress(), GetLDBase(), GetLinkMapAddress(), GetState(), GetVersion(), Resolve(), and TakeSnapshot().

◆ m_exe_file_spec

lldb_private::FileSpec DYLDRendezvous::m_exe_file_spec
protected

Definition at line 181 of file DYLDRendezvous.h.

Referenced by SOEntryIsMainExecutable(), and UpdateExecutablePath().

◆ m_loaded_modules

LoadedModuleInfoList DYLDRendezvous::m_loaded_modules
protected

List of currently loaded SO modules.

Definition at line 191 of file DYLDRendezvous.h.

Referenced by AddSOEntriesFromRemote(), RemoveSOEntriesFromRemote(), SaveSOEntriesFromRemote(), and UpdateSOEntriesFromRemote().

◆ m_previous

Rendezvous DYLDRendezvous::m_previous
protected

Definition at line 188 of file DYLDRendezvous.h.

Referenced by AddSOEntries(), GetAction(), RemoveSOEntries(), and Resolve().

◆ m_process

lldb_private::Process* DYLDRendezvous::m_process
protected

◆ m_removed_soentries

SOEntryList DYLDRendezvous::m_removed_soentries
protected

List of SOEntry's removed from the link map since the last call to Resolve().

Definition at line 202 of file DYLDRendezvous.h.

Referenced by ModulesDidUnload(), RemoveSOEntries(), RemoveSOEntriesFromRemote(), unloaded_begin(), unloaded_end(), UpdateSOEntries(), and UpdateSOEntriesFromRemote().

◆ m_rendezvous_addr

lldb::addr_t DYLDRendezvous::m_rendezvous_addr
protected

Location of the r_debug structure in the inferiors address space.

Definition at line 184 of file DYLDRendezvous.h.

Referenced by GetRendezvousAddress(), IsValid(), and Resolve().

◆ m_soentries

SOEntryList DYLDRendezvous::m_soentries
protected

List of SOEntry objects corresponding to the current link map state.

Definition at line 194 of file DYLDRendezvous.h.

Referenced by AddSOEntries(), AddSOEntriesFromRemote(), begin(), end(), RemoveSOEntries(), RemoveSOEntriesFromRemote(), SaveSOEntriesFromRemote(), UpdateSOEntries(), and UpdateSOEntriesFromRemote().

◆ m_thread_info

ThreadInfo DYLDRendezvous::m_thread_info
protected

Threading metadata read from the inferior.

Definition at line 205 of file DYLDRendezvous.h.

Referenced by DYLDRendezvous(), and GetThreadInfo().


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