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

#include <HexagonDYLDRendezvous.h>

Collaboration diagram for HexagonDYLDRendezvous:
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 = 0, eAdd, eDelete }
 Constants describing the state of the rendezvous. More...
 
typedef SOEntryList::const_iterator iterator
 

Public Member Functions

 HexagonDYLDRendezvous (lldb_private::Process *process)
 
bool Resolve ()
 Update the internal snapshot of runtime linker rendezvous and recompute the currently loaded modules. More...
 
bool IsValid ()
 
lldb::addr_t GetRendezvousAddress () const
 
void SetRendezvousAddress (lldb::addr_t)
 Provide the dyld structure address. More...
 
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...
 
void SetBreakAddress (lldb::addr_t addr)
 In hexagon it is possible that we can know the dyld breakpoint without having to find it from the rendezvous structure. 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 }
 
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 UpdateSOEntriesForAddition ()
 
bool UpdateSOEntriesForDeletion ()
 
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)
 

Protected Attributes

lldb_private::Processm_process
 
char m_exe_path [PATH_MAX]
 
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
 
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 31 of file HexagonDYLDRendezvous.h.

Member Typedef Documentation

◆ iterator

typedef SOEntryList::const_iterator HexagonDYLDRendezvous::iterator

Definition at line 167 of file HexagonDYLDRendezvous.h.

◆ SOEntryList

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

Definition at line 164 of file HexagonDYLDRendezvous.h.

Member Enumeration Documentation

◆ PThreadField

Enumerator
eSize 
eNElem 
eOffset 

Definition at line 241 of file HexagonDYLDRendezvous.h.

◆ RendezvousState

Constants describing the state of the rendezvous.

See also
GetState().
Enumerator
eConsistent 
eAdd 
eDelete 

Definition at line 128 of file HexagonDYLDRendezvous.h.

Constructor & Destructor Documentation

◆ HexagonDYLDRendezvous()

HexagonDYLDRendezvous::HexagonDYLDRendezvous ( lldb_private::Process process)

Member Function Documentation

◆ begin()

iterator HexagonDYLDRendezvous::begin ( ) const
inline

Iterators over all currently loaded modules.

Definition at line 170 of file HexagonDYLDRendezvous.h.

References m_soentries.

Referenced by DumpToLog(), DynamicLoaderHexagonDYLD::LoadAllCurrentModules(), and UpdateSOEntriesForDeletion().

◆ DumpToLog()

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

◆ end()

iterator HexagonDYLDRendezvous::end ( ) const
inline

◆ FindMetadata()

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

◆ GetBreakAddress()

lldb::addr_t HexagonDYLDRendezvous::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 98 of file HexagonDYLDRendezvous.h.

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

Referenced by DumpToLog().

◆ GetLDBase()

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

Definition at line 110 of file HexagonDYLDRendezvous.h.

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

Referenced by DumpToLog().

◆ GetLinkMapAddress()

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

Definition at line 89 of file HexagonDYLDRendezvous.h.

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

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

◆ GetRendezvousAddress()

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

Definition at line 79 of file HexagonDYLDRendezvous.h.

References m_rendezvous_addr.

Referenced by DumpToLog().

◆ GetState()

uint64_t HexagonDYLDRendezvous::GetState ( ) const
inline

Returns the current state of the rendezvous structure.

Definition at line 106 of file HexagonDYLDRendezvous.h.

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

Referenced by DumpToLog().

◆ GetThreadInfo()

const HexagonDYLDRendezvous::ThreadInfo & HexagonDYLDRendezvous::GetThreadInfo ( )

◆ GetVersion()

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

Definition at line 85 of file HexagonDYLDRendezvous.h.

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

Referenced by DumpToLog().

◆ IsValid()

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

Definition at line 107 of file HexagonDYLDRendezvous.cpp.

References LLDB_INVALID_ADDRESS, and m_rendezvous_addr.

Referenced by DynamicLoaderHexagonDYLD::RendezvousBreakpointHit().

◆ loaded_begin()

iterator HexagonDYLDRendezvous::loaded_begin ( ) const
inline

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

Definition at line 175 of file HexagonDYLDRendezvous.h.

References m_added_soentries.

Referenced by DynamicLoaderHexagonDYLD::RefreshModules().

◆ loaded_end()

iterator HexagonDYLDRendezvous::loaded_end ( ) const
inline

Definition at line 176 of file HexagonDYLDRendezvous.h.

References m_added_soentries.

Referenced by DynamicLoaderHexagonDYLD::RefreshModules().

◆ ModulesDidLoad()

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

Definition at line 117 of file HexagonDYLDRendezvous.h.

References m_added_soentries.

Referenced by DynamicLoaderHexagonDYLD::RefreshModules().

◆ ModulesDidUnload()

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

Definition at line 121 of file HexagonDYLDRendezvous.h.

References m_removed_soentries.

Referenced by DynamicLoaderHexagonDYLD::RefreshModules().

◆ ReadPointer()

addr_t HexagonDYLDRendezvous::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 229 of file HexagonDYLDRendezvous.cpp.

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

Referenced by ReadSOEntryFromMemory(), and Resolve().

◆ ReadSOEntryFromMemory()

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

◆ ReadStringFromMemory()

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

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

Definition at line 239 of file HexagonDYLDRendezvous.cpp.

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

Referenced by ReadSOEntryFromMemory().

◆ ReadWord()

addr_t HexagonDYLDRendezvous::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 218 of file HexagonDYLDRendezvous.cpp.

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

Referenced by Resolve().

◆ Resolve()

bool HexagonDYLDRendezvous::Resolve ( )

Update the internal snapshot of runtime linker rendezvous and recompute the currently loaded modules.

This method should be called once one start up, then once each time the runtime linker enters the function given by GetBreakAddress().

Returns
true on success and false on failure.
See also
GetBreakAddress().

Definition at line 61 of file HexagonDYLDRendezvous.cpp.

References HexagonDYLDRendezvous::Rendezvous::brk, lldb_private::Process::GetAddressByteSize(), HexagonDYLDRendezvous::Rendezvous::ldbase, LLDB_INVALID_ADDRESS, m_current, m_previous, m_process, m_rendezvous_addr, HexagonDYLDRendezvous::Rendezvous::map_addr, ReadPointer(), ReadWord(), ResolveRendezvousAddress(), HexagonDYLDRendezvous::Rendezvous::state, UpdateSOEntries(), and HexagonDYLDRendezvous::Rendezvous::version.

Referenced by DynamicLoaderHexagonDYLD::LoadAllCurrentModules(), and DynamicLoaderHexagonDYLD::RefreshModules().

◆ SetBreakAddress()

void HexagonDYLDRendezvous::SetBreakAddress ( lldb::addr_t  addr)
inline

In hexagon it is possible that we can know the dyld breakpoint without having to find it from the rendezvous structure.

Definition at line 103 of file HexagonDYLDRendezvous.h.

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

Referenced by DynamicLoaderHexagonDYLD::SetRendezvousBreakpoint().

◆ SetRendezvousAddress()

void HexagonDYLDRendezvous::SetRendezvousAddress ( lldb::addr_t  addr)

Provide the dyld structure address.

Definition at line 103 of file HexagonDYLDRendezvous.cpp.

References m_rendezvous_addr.

Referenced by DynamicLoaderHexagonDYLD::RendezvousBreakpointHit().

◆ TakeSnapshot()

bool HexagonDYLDRendezvous::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 196 of file HexagonDYLDRendezvous.cpp.

References m_current, m_exe_path, HexagonDYLDRendezvous::Rendezvous::map_addr, HexagonDYLDRendezvous::SOEntry::next, HexagonDYLDRendezvous::SOEntry::path, and ReadSOEntryFromMemory().

Referenced by UpdateSOEntries(), and UpdateSOEntriesForDeletion().

◆ unloaded_begin()

iterator HexagonDYLDRendezvous::unloaded_begin ( ) const
inline

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

Definition at line 180 of file HexagonDYLDRendezvous.h.

References m_removed_soentries.

Referenced by DynamicLoaderHexagonDYLD::RefreshModules().

◆ unloaded_end()

iterator HexagonDYLDRendezvous::unloaded_end ( ) const
inline

Definition at line 181 of file HexagonDYLDRendezvous.h.

References m_removed_soentries.

Referenced by DynamicLoaderHexagonDYLD::RefreshModules().

◆ UpdateSOEntries()

bool HexagonDYLDRendezvous::UpdateSOEntries ( )
protected

◆ UpdateSOEntriesForAddition()

bool HexagonDYLDRendezvous::UpdateSOEntriesForAddition ( )
protected

◆ UpdateSOEntriesForDeletion()

bool HexagonDYLDRendezvous::UpdateSOEntriesForDeletion ( )
protected

Member Data Documentation

◆ m_added_soentries

SOEntryList HexagonDYLDRendezvous::m_added_soentries
protected

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

Definition at line 201 of file HexagonDYLDRendezvous.h.

Referenced by loaded_begin(), loaded_end(), ModulesDidLoad(), UpdateSOEntries(), and UpdateSOEntriesForAddition().

◆ m_current

Rendezvous HexagonDYLDRendezvous::m_current
protected

Current and previous snapshots of the rendezvous structure.

Definition at line 193 of file HexagonDYLDRendezvous.h.

Referenced by GetBreakAddress(), GetLDBase(), GetLinkMapAddress(), GetState(), GetVersion(), Resolve(), SetBreakAddress(), TakeSnapshot(), UpdateSOEntries(), and UpdateSOEntriesForAddition().

◆ m_exe_path

char HexagonDYLDRendezvous::m_exe_path[PATH_MAX]
protected

◆ m_previous

Rendezvous HexagonDYLDRendezvous::m_previous
protected

◆ m_process

lldb_private::Process* HexagonDYLDRendezvous::m_process
protected

◆ m_removed_soentries

SOEntryList HexagonDYLDRendezvous::m_removed_soentries
protected

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

Definition at line 205 of file HexagonDYLDRendezvous.h.

Referenced by ModulesDidUnload(), unloaded_begin(), unloaded_end(), UpdateSOEntries(), and UpdateSOEntriesForDeletion().

◆ m_rendezvous_addr

lldb::addr_t HexagonDYLDRendezvous::m_rendezvous_addr
protected

Location of the r_debug structure in the inferiors address space.

Definition at line 190 of file HexagonDYLDRendezvous.h.

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

◆ m_soentries

SOEntryList HexagonDYLDRendezvous::m_soentries
protected

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

Definition at line 197 of file HexagonDYLDRendezvous.h.

Referenced by begin(), end(), UpdateSOEntries(), UpdateSOEntriesForAddition(), and UpdateSOEntriesForDeletion().

◆ m_thread_info

ThreadInfo HexagonDYLDRendezvous::m_thread_info
protected

Threading metadata read from the inferior.

Definition at line 208 of file HexagonDYLDRendezvous.h.

Referenced by GetThreadInfo(), and HexagonDYLDRendezvous().


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