LLDB mainline
lldb_private::BreakpointLocationList Class Reference

"lldb/Breakpoint/BreakpointLocationList.h" This class is used by Breakpoint to manage a list of breakpoint locations, each breakpoint location in the list has a unique ID, and is unique by Address as well. More...

#include <BreakpointLocationList.h>

Public Types

typedef llvm::iterator_range< collection::const_iterator > BreakpointLocationIterable

Public Member Functions

virtual ~BreakpointLocationList ()
void Dump (Stream *s) const
 Standard "Dump" method. At present it does nothing.
const lldb::BreakpointLocationSP FindByAddress (const Address &addr) const
 Returns a shared pointer to the breakpoint location at address addr - const version.
lldb::BreakpointLocationSP FindByID (lldb::break_id_t breakID) const
 Returns a shared pointer to the breakpoint location with id breakID, const version.
lldb::break_id_t FindIDByAddress (const Address &addr)
 Returns the breakpoint location id to the breakpoint location at address addr.
size_t FindInModule (Module *module, BreakpointLocationCollection &bp_loc_list)
 Returns a breakpoint location list of the breakpoint locations in the module module.
lldb::BreakpointLocationSP GetByIndex (size_t i)
 Returns a shared pointer to the breakpoint location with index i.
const lldb::BreakpointLocationSP GetByIndex (size_t i) const
 Returns a shared pointer to the breakpoint location with index i, const version.
void ClearAllBreakpointSites ()
 Removes all the locations in this list from their breakpoint site owners list.
void ResolveAllBreakpointSites ()
 Tells all the breakpoint locations in this list to attempt to resolve any possible breakpoint sites.
size_t GetNumResolvedLocations () const
 Returns the number of breakpoint locations in this list with resolved breakpoints.
uint32_t GetHitCount () const
 Returns the number hit count of all locations in this list.
void ResetHitCount ()
 Resets the hit count of all locations in this list.
bool ShouldStop (StoppointCallbackContext *context, lldb::break_id_t breakID)
 Enquires of the breakpoint location in this list with ID breakID whether we should stop.
size_t GetSize () const
 Returns the number of elements in this breakpoint location list.
void GetDescription (Stream *s, lldb::DescriptionLevel level)
 Print a description of the breakpoint locations in this list to the stream s.
BreakpointLocationIterable BreakpointLocations ()

Protected Types

typedef std::vector< lldb::BreakpointLocationSPcollection
typedef std::map< lldb_private::Address, lldb::BreakpointLocationSP, Address::ModulePointerAndOffsetLessThanFunctionObjectaddr_map

Protected Member Functions

 BreakpointLocationList (Breakpoint &owner)
 This is the standard constructor.
lldb::BreakpointLocationSP Create (const Address &addr, bool resolve_indirect_symbols)
void StartRecordingNewLocations (BreakpointLocationCollection &new_locations)
void StopRecordingNewLocations ()
lldb::BreakpointLocationSP AddLocation (const Address &addr, bool resolve_indirect_symbols, bool *new_location=nullptr)
void SwapLocation (lldb::BreakpointLocationSP to_location_sp, lldb::BreakpointLocationSP from_location_sp)
bool RemoveLocation (const lldb::BreakpointLocationSP &bp_loc_sp)
void RemoveLocationByIndex (size_t idx)
void RemoveInvalidLocations (const ArchSpec &arch)
void Compact ()

Protected Attributes

Breakpointm_owner
collection m_locations
addr_map m_address_to_location
std::recursive_mutex m_mutex
lldb::break_id_t m_next_id
BreakpointLocationCollectionm_new_location_recorder

Friends

class Breakpoint

Detailed Description

"lldb/Breakpoint/BreakpointLocationList.h" This class is used by Breakpoint to manage a list of breakpoint locations, each breakpoint location in the list has a unique ID, and is unique by Address as well.

Definition at line 26 of file BreakpointLocationList.h.

Member Typedef Documentation

◆ addr_map

◆ BreakpointLocationIterable

typedef llvm::iterator_range<collection::const_iterator> lldb_private::BreakpointLocationList::BreakpointLocationIterable

Definition at line 208 of file BreakpointLocationList.h.

◆ collection

Constructor & Destructor Documentation

◆ ~BreakpointLocationList()

BreakpointLocationList::~BreakpointLocationList ( )
virtualdefault

◆ BreakpointLocationList()

BreakpointLocationList::BreakpointLocationList ( Breakpoint & owner)
protected

This is the standard constructor.

It creates an empty breakpoint location list. It is protected here because only Breakpoints are allowed to create the breakpoint location list.

Definition at line 24 of file BreakpointLocationList.cpp.

References Breakpoint, m_new_location_recorder, m_next_id, and m_owner.

Member Function Documentation

◆ AddLocation()

BreakpointLocationSP BreakpointLocationList::AddLocation ( const Address & addr,
bool resolve_indirect_symbols,
bool * new_location = nullptr )
protected

◆ BreakpointLocations()

BreakpointLocationIterable lldb_private::BreakpointLocationList::BreakpointLocations ( )
inline

Definition at line 210 of file BreakpointLocationList.h.

References m_locations.

◆ ClearAllBreakpointSites()

void BreakpointLocationList::ClearAllBreakpointSites ( )

Removes all the locations in this list from their breakpoint site owners list.

Definition at line 153 of file BreakpointLocationList.cpp.

References lldb_private::Breakpoints, error(), lldb_private::GetLog(), LLDB_LOG_ERROR, m_locations, and m_mutex.

◆ Compact()

void BreakpointLocationList::Compact ( )
protected

Definition at line 316 of file BreakpointLocationList.cpp.

References m_locations, and m_next_id.

◆ Create()

BreakpointLocationSP BreakpointLocationList::Create ( const Address & addr,
bool resolve_indirect_symbols )
protected

◆ Dump()

void BreakpointLocationList::Dump ( Stream * s) const

Standard "Dump" method. At present it does nothing.

Definition at line 122 of file BreakpointLocationList.cpp.

References lldb_private::Stream::IndentLess(), lldb_private::Stream::IndentMore(), m_locations, m_mutex, and lldb_private::Stream::Printf().

◆ FindByAddress()

const BreakpointLocationSP BreakpointLocationList::FindByAddress ( const Address & addr) const

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

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

Definition at line 97 of file BreakpointLocationList.cpp.

References lldb_private::Address::GetOffset(), lldb_private::Address::IsSectionOffset(), lldb_private::Address::IsValid(), m_address_to_location, m_locations, m_mutex, and m_owner.

Referenced by AddLocation(), and FindIDByAddress().

◆ FindByID()

BreakpointLocationSP BreakpointLocationList::FindByID ( lldb::break_id_t breakID) const

Returns a shared pointer to the breakpoint location with id breakID, const version.

Parameters
[in]breakIDThe breakpoint location ID to seek for.
Returns
A shared pointer to the breakpoint. May contain a nullptr pointer if the breakpoint doesn't exist.

Definition at line 70 of file BreakpointLocationList.cpp.

References Compare(), m_locations, and m_mutex.

Referenced by ShouldStop().

◆ FindIDByAddress()

lldb::break_id_t BreakpointLocationList::FindIDByAddress ( const Address & addr)

Returns the breakpoint location id to the breakpoint location at address addr.

Parameters
[in]addrThe address to match.
Returns
The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID.

Definition at line 57 of file BreakpointLocationList.cpp.

References FindByAddress(), and LLDB_INVALID_BREAK_ID.

◆ FindInModule()

size_t BreakpointLocationList::FindInModule ( Module * module,
BreakpointLocationCollection & bp_loc_list )

Returns a breakpoint location list of the breakpoint locations in the module module.

This list is allocated, and owned by the caller.

Parameters
[in]moduleThe module to seek in.
[in]bp_loc_listA breakpoint collection that gets any breakpoint locations that match module appended to.
Returns
The number of matches

Definition at line 80 of file BreakpointLocationList.cpp.

References lldb_private::BreakpointLocationCollection::Add(), lldb_private::BreakpointLocationCollection::GetSize(), m_locations, and m_mutex.

◆ GetByIndex() [1/2]

BreakpointLocationSP BreakpointLocationList::GetByIndex ( size_t i)

Returns a shared pointer to the breakpoint location with index i.

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

Definition at line 135 of file BreakpointLocationList.cpp.

References m_locations, and m_mutex.

◆ GetByIndex() [2/2]

const BreakpointLocationSP BreakpointLocationList::GetByIndex ( size_t i) const

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

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

Definition at line 144 of file BreakpointLocationList.cpp.

References m_locations, and m_mutex.

◆ GetDescription()

void BreakpointLocationList::GetDescription ( Stream * s,
lldb::DescriptionLevel level )

Print a description of the breakpoint locations 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 203 of file BreakpointLocationList.cpp.

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

◆ GetHitCount()

uint32_t BreakpointLocationList::GetHitCount ( ) const

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

Returns
Hit count of all locations in this list.

Definition at line 177 of file BreakpointLocationList.cpp.

References m_locations, and m_mutex.

◆ GetNumResolvedLocations()

size_t BreakpointLocationList::GetNumResolvedLocations ( ) const

Returns the number of breakpoint locations in this list with resolved breakpoints.

Returns
Number of qualifying breakpoint locations.

Definition at line 192 of file BreakpointLocationList.cpp.

References m_locations, and m_mutex.

◆ GetSize()

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

Returns the number of elements in this breakpoint location list.

Returns
The number of elements.

Definition at line 149 of file BreakpointLocationList.h.

References m_locations.

◆ RemoveInvalidLocations()

◆ RemoveLocation()

bool BreakpointLocationList::RemoveLocation ( const lldb::BreakpointLocationSP & bp_loc_sp)
protected

Definition at line 250 of file BreakpointLocationList.cpp.

References m_address_to_location, m_locations, m_mutex, and RemoveLocationByIndex().

Referenced by SwapLocation().

◆ RemoveLocationByIndex()

void BreakpointLocationList::RemoveLocationByIndex ( size_t idx)
protected

Definition at line 268 of file BreakpointLocationList.cpp.

References m_address_to_location, and m_locations.

Referenced by RemoveInvalidLocations(), and RemoveLocation().

◆ ResetHitCount()

void BreakpointLocationList::ResetHitCount ( )

Resets the hit count of all locations in this list.

Definition at line 186 of file BreakpointLocationList.cpp.

References m_locations, and m_mutex.

◆ ResolveAllBreakpointSites()

void BreakpointLocationList::ResolveAllBreakpointSites ( )

Tells all the breakpoint locations in this list to attempt to resolve any possible breakpoint sites.

Definition at line 164 of file BreakpointLocationList.cpp.

References lldb_private::Breakpoints, error(), lldb_private::GetLog(), LLDB_LOG_ERROR, m_locations, and m_mutex.

◆ ShouldStop()

bool BreakpointLocationList::ShouldStop ( StoppointCallbackContext * context,
lldb::break_id_t breakID )

Enquires of the breakpoint location in this list with ID breakID whether we should stop.

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

Definition at line 43 of file BreakpointLocationList.cpp.

References FindByID().

◆ StartRecordingNewLocations()

void BreakpointLocationList::StartRecordingNewLocations ( BreakpointLocationCollection & new_locations)
protected

Definition at line 304 of file BreakpointLocationList.cpp.

References m_mutex, and m_new_location_recorder.

◆ StopRecordingNewLocations()

void BreakpointLocationList::StopRecordingNewLocations ( )
protected

Definition at line 311 of file BreakpointLocationList.cpp.

References m_mutex, and m_new_location_recorder.

◆ SwapLocation()

void BreakpointLocationList::SwapLocation ( lldb::BreakpointLocationSP to_location_sp,
lldb::BreakpointLocationSP from_location_sp )
protected

Definition at line 237 of file BreakpointLocationList.cpp.

References m_address_to_location, and RemoveLocation().

◆ Breakpoint

friend class Breakpoint
friend

Definition at line 32 of file BreakpointLocationList.h.

References Breakpoint.

Referenced by Breakpoint, and BreakpointLocationList().

Member Data Documentation

◆ m_address_to_location

addr_map lldb_private::BreakpointLocationList::m_address_to_location
protected

◆ m_locations

◆ m_mutex

◆ m_new_location_recorder

BreakpointLocationCollection* lldb_private::BreakpointLocationList::m_new_location_recorder
protected

◆ m_next_id

lldb::break_id_t lldb_private::BreakpointLocationList::m_next_id
protected

Definition at line 203 of file BreakpointLocationList.h.

Referenced by BreakpointLocationList(), Compact(), and Create().

◆ m_owner

Breakpoint& lldb_private::BreakpointLocationList::m_owner
protected

Definition at line 199 of file BreakpointLocationList.h.

Referenced by BreakpointLocationList(), Create(), and FindByAddress().


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