aboutsummaryrefslogtreecommitdiff
path: root/source/Breakpoint/BreakpointLocationList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Breakpoint/BreakpointLocationList.cpp')
-rw-r--r--source/Breakpoint/BreakpointLocationList.cpp45
1 files changed, 20 insertions, 25 deletions
diff --git a/source/Breakpoint/BreakpointLocationList.cpp b/source/Breakpoint/BreakpointLocationList.cpp
index d57cfa68fb80..5e56299bfe78 100644
--- a/source/Breakpoint/BreakpointLocationList.cpp
+++ b/source/Breakpoint/BreakpointLocationList.cpp
@@ -24,13 +24,8 @@
using namespace lldb;
using namespace lldb_private;
-BreakpointLocationList::BreakpointLocationList(Breakpoint &owner) :
- m_owner (owner),
- m_locations(),
- m_address_to_location (),
- m_mutex (Mutex::eMutexTypeRecursive),
- m_next_id (0),
- m_new_location_recorder (nullptr)
+BreakpointLocationList::BreakpointLocationList(Breakpoint &owner)
+ : m_owner(owner), m_locations(), m_address_to_location(), m_mutex(), m_next_id(0), m_new_location_recorder(nullptr)
{
}
@@ -39,7 +34,7 @@ BreakpointLocationList::~BreakpointLocationList() = default;
BreakpointLocationSP
BreakpointLocationList::Create (const Address &addr, bool resolve_indirect_symbols)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
// The location ID is just the size of the location list + 1
lldb::break_id_t bp_loc_id = ++m_next_id;
BreakpointLocationSP bp_loc_sp (new BreakpointLocation (bp_loc_id, m_owner, addr, LLDB_INVALID_THREAD_ID, m_owner.IsHardware(), resolve_indirect_symbols));
@@ -84,7 +79,7 @@ Compare (BreakpointLocationSP lhs, lldb::break_id_t val)
BreakpointLocationSP
BreakpointLocationList::FindByID (lldb::break_id_t break_id) const
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::const_iterator end = m_locations.end();
collection::const_iterator pos = std::lower_bound(m_locations.begin(), end, break_id, Compare);
if (pos != end && (*pos)->GetID() == break_id)
@@ -97,7 +92,7 @@ size_t
BreakpointLocationList::FindInModule (Module *module,
BreakpointLocationCollection& bp_loc_list)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
const size_t orig_size = bp_loc_list.GetSize();
collection::iterator pos, end = m_locations.end();
@@ -116,7 +111,7 @@ BreakpointLocationList::FindInModule (Module *module,
const BreakpointLocationSP
BreakpointLocationList::FindByAddress (const Address &addr) const
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
BreakpointLocationSP bp_loc_sp;
if (!m_locations.empty())
{
@@ -150,7 +145,7 @@ BreakpointLocationList::Dump (Stream *s) const
{
s->Printf("%p: ", static_cast<const void*>(this));
//s->Indent();
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
s->Printf("BreakpointLocationList with %" PRIu64 " BreakpointLocations:\n", (uint64_t)m_locations.size());
s->IndentMore();
collection::const_iterator pos, end = m_locations.end();
@@ -162,7 +157,7 @@ BreakpointLocationList::Dump (Stream *s) const
BreakpointLocationSP
BreakpointLocationList::GetByIndex (size_t i)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
BreakpointLocationSP bp_loc_sp;
if (i < m_locations.size())
bp_loc_sp = m_locations[i];
@@ -173,7 +168,7 @@ BreakpointLocationList::GetByIndex (size_t i)
const BreakpointLocationSP
BreakpointLocationList::GetByIndex (size_t i) const
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
BreakpointLocationSP bp_loc_sp;
if (i < m_locations.size())
bp_loc_sp = m_locations[i];
@@ -184,7 +179,7 @@ BreakpointLocationList::GetByIndex (size_t i) const
void
BreakpointLocationList::ClearAllBreakpointSites ()
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::iterator pos, end = m_locations.end();
for (pos = m_locations.begin(); pos != end; ++pos)
(*pos)->ClearBreakpointSite();
@@ -193,7 +188,7 @@ BreakpointLocationList::ClearAllBreakpointSites ()
void
BreakpointLocationList::ResolveAllBreakpointSites ()
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::iterator pos, end = m_locations.end();
for (pos = m_locations.begin(); pos != end; ++pos)
@@ -207,7 +202,7 @@ uint32_t
BreakpointLocationList::GetHitCount () const
{
uint32_t hit_count = 0;
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::const_iterator pos, end = m_locations.end();
for (pos = m_locations.begin(); pos != end; ++pos)
hit_count += (*pos)->GetHitCount();
@@ -217,7 +212,7 @@ BreakpointLocationList::GetHitCount () const
size_t
BreakpointLocationList::GetNumResolvedLocations() const
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
size_t resolve_count = 0;
collection::const_iterator pos, end = m_locations.end();
for (pos = m_locations.begin(); pos != end; ++pos)
@@ -231,7 +226,7 @@ BreakpointLocationList::GetNumResolvedLocations() const
void
BreakpointLocationList::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::iterator pos, end = m_locations.end();
for (pos = m_locations.begin(); pos != end; ++pos)
@@ -244,7 +239,7 @@ BreakpointLocationList::GetDescription (Stream *s, lldb::DescriptionLevel level)
BreakpointLocationSP
BreakpointLocationList::AddLocation (const Address &addr, bool resolve_indirect_symbols, bool *new_location)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (new_location)
*new_location = false;
@@ -285,8 +280,8 @@ BreakpointLocationList::RemoveLocation (const lldb::BreakpointLocationSP &bp_loc
{
if (bp_loc_sp)
{
- Mutex::Locker locker (m_mutex);
-
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+
m_address_to_location.erase (bp_loc_sp->GetAddress());
collection::iterator pos, end = m_locations.end();
@@ -305,7 +300,7 @@ BreakpointLocationList::RemoveLocation (const lldb::BreakpointLocationSP &bp_loc
void
BreakpointLocationList::RemoveInvalidLocations (const ArchSpec &arch)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
size_t idx = 0;
// Don't cache m_location.size() as it will change since we might
// remove locations from our vector...
@@ -341,7 +336,7 @@ BreakpointLocationList::RemoveInvalidLocations (const ArchSpec &arch)
void
BreakpointLocationList::StartRecordingNewLocations (BreakpointLocationCollection &new_locations)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
assert(m_new_location_recorder == nullptr);
m_new_location_recorder = &new_locations;
}
@@ -349,7 +344,7 @@ BreakpointLocationList::StartRecordingNewLocations (BreakpointLocationCollection
void
BreakpointLocationList::StopRecordingNewLocations ()
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_new_location_recorder = nullptr;
}