LLDB mainline
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
lldb_private::WatchpointList Class Reference

This class is used by Watchpoint to manage a list of watchpoints,. More...

#include "lldb/Breakpoint/WatchpointList.h"

Public Types

typedef std::list< lldb::WatchpointSPwp_collection
 
typedef LockingAdaptedIterable< wp_collection, lldb::WatchpointSP, vector_adapter, std::recursive_mutex > WatchpointIterable
 

Public Member Functions

 WatchpointList ()
 Default constructor makes an empty list.
 
 ~WatchpointList ()
 Destructor, currently does nothing.
 
lldb::watch_id_t Add (const lldb::WatchpointSP &wp_sp, bool notify)
 Add a Watchpoint to the list.
 
void Dump (Stream *s) const
 Standard "Dump" method.
 
void DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const
 Dump with lldb::DescriptionLevel.
 
const lldb::WatchpointSP FindByAddress (lldb::addr_t addr) const
 Returns a shared pointer to the watchpoint at address addr - const version.
 
const lldb::WatchpointSP FindBySpec (std::string spec) const
 Returns a shared pointer to the watchpoint with watchpoint spec spec.
 
lldb::WatchpointSP FindByID (lldb::watch_id_t watchID) const
 Returns a shared pointer to the watchpoint with id watchID, const version.
 
lldb::watch_id_t FindIDByAddress (lldb::addr_t addr)
 Returns the watchpoint id to the watchpoint at address addr.
 
lldb::watch_id_t FindIDBySpec (std::string spec)
 Returns the watchpoint id to the watchpoint with watchpoint spec spec.
 
lldb::WatchpointSP GetByIndex (uint32_t i)
 Returns a shared pointer to the watchpoint with index i.
 
const lldb::WatchpointSP GetByIndex (uint32_t i) const
 Returns a shared pointer to the watchpoint with index i, const version.
 
bool Remove (lldb::watch_id_t watchID, bool notify)
 Removes the watchpoint given by watchID from this list.
 
uint32_t GetHitCount () const
 Returns the number hit count of all watchpoints in this list.
 
bool ShouldStop (StoppointCallbackContext *context, lldb::watch_id_t watchID)
 Enquires of the watchpoint in this list with ID watchID whether we should stop.
 
size_t GetSize () const
 Returns the number of elements in this watchpoint list.
 
void GetDescription (Stream *s, lldb::DescriptionLevel level)
 Print a description of the watchpoints in this list to the stream s.
 
void SetEnabledAll (bool enabled)
 
void RemoveAll (bool notify)
 
void GetListMutex (std::unique_lock< std::recursive_mutex > &lock)
 Sets the passed in Locker to hold the Watchpoint List mutex.
 
WatchpointIterable Watchpoints () const
 

Protected Types

typedef std::vector< lldb::watch_id_tid_vector
 

Protected Member Functions

id_vector GetWatchpointIDs () const
 
wp_collection::iterator GetIDIterator (lldb::watch_id_t watchID)
 
wp_collection::const_iterator GetIDConstIterator (lldb::watch_id_t watchID) const
 

Protected Attributes

wp_collection m_watchpoints
 
std::recursive_mutex m_mutex
 
lldb::watch_id_t m_next_wp_id = 0
 

Friends

class Watchpoint
 
class Target
 

Detailed Description

This class is used by Watchpoint to manage a list of watchpoints,.

Definition at line 27 of file WatchpointList.h.

Member Typedef Documentation

◆ id_vector

Definition at line 198 of file WatchpointList.h.

◆ WatchpointIterable

Definition at line 44 of file WatchpointList.h.

◆ wp_collection

Definition at line 41 of file WatchpointList.h.

Constructor & Destructor Documentation

◆ WatchpointList()

WatchpointList::WatchpointList ( )
default

Default constructor makes an empty list.

◆ ~WatchpointList()

WatchpointList::~WatchpointList ( )
default

Destructor, currently does nothing.

Member Function Documentation

◆ Add()

lldb::watch_id_t WatchpointList::Add ( const lldb::WatchpointSP wp_sp,
bool  notify 
)

Add a Watchpoint to the list.

Parameters
[in]wp_spA shared pointer to a watchpoint being added to the list.
Returns
The ID of the Watchpoint in the list.

Definition at line 20 of file WatchpointList.cpp.

References lldb_private::Target::eBroadcastBitWatchpointChanged, m_mutex, m_next_wp_id, and m_watchpoints.

Referenced by lldb_private::Target::CreateWatchpoint().

◆ Dump()

void WatchpointList::Dump ( Stream s) const

Standard "Dump" method.

Definition at line 36 of file WatchpointList.cpp.

References DumpWithLevel(), and lldb::eDescriptionLevelBrief.

◆ DumpWithLevel()

void WatchpointList::DumpWithLevel ( Stream s,
lldb::DescriptionLevel  description_level 
) const

◆ FindByAddress()

const WatchpointSP WatchpointList::FindByAddress ( lldb::addr_t  addr) const

Returns a shared pointer to the watchpoint at address addr - const version.

Parameters
[in]addrThe address to look for.
Returns
A shared pointer to the watchpoint. May contain a NULL pointer if the watchpoint doesn't exist.

Definition at line 54 of file WatchpointList.cpp.

References m_mutex, and m_watchpoints.

Referenced by lldb_private::StopInfoMachException::CreateStopReasonWithMachException(), lldb_private::Target::CreateWatchpoint(), and FindIDByAddress().

◆ FindByID()

WatchpointSP WatchpointList::FindByID ( lldb::watch_id_t  watchID) const

Returns a shared pointer to the watchpoint with id watchID, const version.

Parameters
[in]watchIDThe watchpoint location ID to seek for.
Returns
A shared pointer to the watchpoint. May contain a NULL pointer if the watchpoint doesn't exist.

Definition at line 113 of file WatchpointList.cpp.

References GetIDConstIterator(), m_mutex, and m_watchpoints.

Referenced by lldb_private::Target::DisableWatchpointByID(), CommandObjectWatchpointList::DoExecute(), CommandObjectWatchpointModify::DoExecute(), CommandObjectWatchpointCommandDelete::DoExecute(), CommandObjectWatchpointCommandList::DoExecute(), lldb_private::Target::EnableWatchpointByID(), lldb_private::Target::IgnoreWatchpointByID(), lldb_private::Target::RemoveWatchpointByID(), ShouldStop(), and lldb_private::ScriptInterpreterLua::WatchpointCallbackFunction().

◆ FindBySpec()

const WatchpointSP WatchpointList::FindBySpec ( std::string  spec) const

Returns a shared pointer to the watchpoint with watchpoint spec spec.

  • const version.
Parameters
[in]specThe watchpoint spec to look for.
Returns
A shared pointer to the watchpoint. May contain a NULL pointer if the watchpoint doesn't exist.

Definition at line 72 of file WatchpointList.cpp.

References m_mutex, and m_watchpoints.

Referenced by FindIDBySpec().

◆ FindIDByAddress()

lldb::watch_id_t WatchpointList::FindIDByAddress ( lldb::addr_t  addr)

Returns the watchpoint id to the watchpoint at address addr.

Parameters
[in]addrThe address to match.
Returns
The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.

Definition at line 123 of file WatchpointList.cpp.

References FindByAddress(), and LLDB_INVALID_WATCH_ID.

◆ FindIDBySpec()

lldb::watch_id_t WatchpointList::FindIDBySpec ( std::string  spec)

Returns the watchpoint id to the watchpoint with watchpoint spec spec.

Parameters
[in]specThe watchpoint spec to match.
Returns
The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.

Definition at line 131 of file WatchpointList.cpp.

References FindBySpec(), and LLDB_INVALID_WATCH_ID.

◆ GetByIndex() [1/2]

WatchpointSP WatchpointList::GetByIndex ( uint32_t  i)

Returns a shared pointer to the watchpoint with index i.

Parameters
[in]iThe watchpoint index to seek for.
Returns
A shared pointer to the watchpoint. May contain a NULL pointer if the watchpoint doesn't exist.

Definition at line 139 of file WatchpointList.cpp.

References m_mutex, and m_watchpoints.

Referenced by CommandObjectWatchpointList::DoExecute().

◆ GetByIndex() [2/2]

const WatchpointSP WatchpointList::GetByIndex ( uint32_t  i) const

Returns a shared pointer to the watchpoint with index i, const version.

Parameters
[in]iThe watchpoint index to seek for.
Returns
A shared pointer to the watchpoint. May contain a NULL pointer if the watchpoint location doesn't exist.

Definition at line 150 of file WatchpointList.cpp.

References m_mutex, and m_watchpoints.

◆ GetDescription()

void WatchpointList::GetDescription ( Stream s,
lldb::DescriptionLevel  level 
)

Print a description of the watchpoints in this list to the stream s.

Parameters
[in]sThe stream to which to print the description.
[in]levelThe description level that indicates the detail level to provide.
See also
lldb::DescriptionLevel

Definition at line 213 of file WatchpointList.cpp.

References m_mutex, m_watchpoints, and lldb_private::Stream::Printf().

◆ GetHitCount()

uint32_t WatchpointList::GetHitCount ( ) const

Returns the number hit count of all watchpoints in this list.

Returns
Hit count of all watchpoints in this list.

Definition at line 189 of file WatchpointList.cpp.

References m_mutex, and m_watchpoints.

◆ GetIDConstIterator()

WatchpointList::wp_collection::const_iterator WatchpointList::GetIDConstIterator ( lldb::watch_id_t  watchID) const
protected

Definition at line 107 of file WatchpointList.cpp.

References m_watchpoints.

Referenced by FindByID().

◆ GetIDIterator()

WatchpointList::wp_collection::iterator WatchpointList::GetIDIterator ( lldb::watch_id_t  watchID)
protected

Definition at line 100 of file WatchpointList.cpp.

References m_watchpoints.

Referenced by Remove().

◆ GetListMutex()

void WatchpointList::GetListMutex ( std::unique_lock< std::recursive_mutex > &  lock)

◆ GetSize()

size_t lldb_private::WatchpointList::GetSize ( ) const
inline

◆ GetWatchpointIDs()

std::vector< lldb::watch_id_t > WatchpointList::GetWatchpointIDs ( ) const
protected

Definition at line 161 of file WatchpointList.cpp.

References m_watchpoints.

◆ Remove()

bool WatchpointList::Remove ( lldb::watch_id_t  watchID,
bool  notify 
)

Removes the watchpoint given by watchID from this list.

Parameters
[in]watchIDThe watchpoint ID to remove.
Returns
true if the watchpoint watchID was in the list.

Definition at line 169 of file WatchpointList.cpp.

References lldb_private::Target::eBroadcastBitWatchpointChanged, GetIDIterator(), m_mutex, and m_watchpoints.

Referenced by lldb_private::Target::CreateWatchpoint(), and lldb_private::Target::RemoveWatchpointByID().

◆ RemoveAll()

void WatchpointList::RemoveAll ( bool  notify)

◆ SetEnabledAll()

void WatchpointList::SetEnabledAll ( bool  enabled)

◆ ShouldStop()

bool WatchpointList::ShouldStop ( StoppointCallbackContext context,
lldb::watch_id_t  watchID 
)

Enquires of the watchpoint in this list with ID watchID whether we should stop.

Parameters
[in]contextThis contains the information about this stop.
[in]watchIDThis watch ID that we hit.
Returns
true if we should stop, false otherwise.

Definition at line 198 of file WatchpointList.cpp.

References FindByID().

◆ Watchpoints()

WatchpointIterable lldb_private::WatchpointList::Watchpoints ( ) const
inline

Friends And Related Function Documentation

◆ Target

friend class Target
friend

Definition at line 32 of file WatchpointList.h.

◆ Watchpoint

friend class Watchpoint
friend

Definition at line 31 of file WatchpointList.h.

Member Data Documentation

◆ m_mutex

std::recursive_mutex lldb_private::WatchpointList::m_mutex
mutableprotected

◆ m_next_wp_id

lldb::watch_id_t lldb_private::WatchpointList::m_next_wp_id = 0
protected

Definition at line 210 of file WatchpointList.h.

Referenced by Add().

◆ m_watchpoints

wp_collection lldb_private::WatchpointList::m_watchpoints
protected

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