aboutsummaryrefslogtreecommitdiff
path: root/source/Breakpoint
diff options
context:
space:
mode:
Diffstat (limited to 'source/Breakpoint')
-rw-r--r--source/Breakpoint/Breakpoint.cpp4
-rw-r--r--source/Breakpoint/BreakpointList.cpp37
-rw-r--r--source/Breakpoint/BreakpointLocation.cpp87
-rw-r--r--source/Breakpoint/BreakpointLocationCollection.cpp10
-rw-r--r--source/Breakpoint/BreakpointLocationList.cpp45
-rw-r--r--source/Breakpoint/BreakpointResolver.cpp29
-rw-r--r--source/Breakpoint/BreakpointResolverAddress.cpp2
-rw-r--r--source/Breakpoint/BreakpointResolverFileLine.cpp4
-rw-r--r--source/Breakpoint/BreakpointResolverFileRegex.cpp38
-rw-r--r--source/Breakpoint/BreakpointResolverName.cpp94
-rw-r--r--source/Breakpoint/BreakpointSite.cpp40
-rw-r--r--source/Breakpoint/BreakpointSiteList.cpp28
-rw-r--r--source/Breakpoint/Makefile14
-rw-r--r--source/Breakpoint/WatchpointList.cpp33
14 files changed, 235 insertions, 230 deletions
diff --git a/source/Breakpoint/Breakpoint.cpp b/source/Breakpoint/Breakpoint.cpp
index 54f67b90220a..224f266fe111 100644
--- a/source/Breakpoint/Breakpoint.cpp
+++ b/source/Breakpoint/Breakpoint.cpp
@@ -410,8 +410,8 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load, bool delete_loca
if (log)
log->Printf ("Breakpoint::ModulesChanged: num_modules: %zu load: %i delete_locations: %i\n",
module_list.GetSize(), load, delete_locations);
-
- Mutex::Locker modules_mutex(module_list.GetMutex());
+
+ std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
if (load)
{
// The logic for handling new modules is:
diff --git a/source/Breakpoint/BreakpointList.cpp b/source/Breakpoint/BreakpointList.cpp
index 650737761547..9877c2d1246c 100644
--- a/source/Breakpoint/BreakpointList.cpp
+++ b/source/Breakpoint/BreakpointList.cpp
@@ -18,11 +18,8 @@
using namespace lldb;
using namespace lldb_private;
-BreakpointList::BreakpointList (bool is_internal) :
- m_mutex (Mutex::eMutexTypeRecursive),
- m_breakpoints(),
- m_next_break_id (0),
- m_is_internal (is_internal)
+BreakpointList::BreakpointList(bool is_internal)
+ : m_mutex(), m_breakpoints(), m_next_break_id(0), m_is_internal(is_internal)
{
}
@@ -34,7 +31,7 @@ BreakpointList::~BreakpointList()
break_id_t
BreakpointList::Add (BreakpointSP &bp_sp, bool notify)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
// Internal breakpoint IDs are negative, normal ones are positive
bp_sp->SetID (m_is_internal ? --m_next_break_id : ++m_next_break_id);
@@ -51,7 +48,7 @@ BreakpointList::Add (BreakpointSP &bp_sp, bool notify)
bool
BreakpointList::Remove (break_id_t break_id, bool notify)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
bp_collection::iterator pos = GetBreakpointIDIterator(break_id); // Predicate
if (pos != m_breakpoints.end())
{
@@ -71,7 +68,7 @@ BreakpointList::Remove (break_id_t break_id, bool notify)
void
BreakpointList::RemoveInvalidLocations (const ArchSpec &arch)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
for (const auto &bp_sp : m_breakpoints)
bp_sp->RemoveInvalidLocations(arch);
}
@@ -80,7 +77,7 @@ BreakpointList::RemoveInvalidLocations (const ArchSpec &arch)
void
BreakpointList::SetEnabledAll (bool enabled)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
for (const auto &bp_sp : m_breakpoints)
bp_sp->SetEnabled (enabled);
}
@@ -89,7 +86,7 @@ BreakpointList::SetEnabledAll (bool enabled)
void
BreakpointList::RemoveAll (bool notify)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
ClearAllBreakpointSites ();
if (notify)
@@ -142,7 +139,7 @@ BreakpointList::GetBreakpointIDConstIterator (break_id_t break_id) const
BreakpointSP
BreakpointList::FindBreakpointByID (break_id_t break_id)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
BreakpointSP stop_sp;
bp_collection::iterator pos = GetBreakpointIDIterator(break_id);
if (pos != m_breakpoints.end())
@@ -154,7 +151,7 @@ BreakpointList::FindBreakpointByID (break_id_t break_id)
const BreakpointSP
BreakpointList::FindBreakpointByID (break_id_t break_id) const
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
BreakpointSP stop_sp;
bp_collection::const_iterator pos = GetBreakpointIDConstIterator(break_id);
if (pos != m_breakpoints.end())
@@ -166,7 +163,7 @@ BreakpointList::FindBreakpointByID (break_id_t break_id) const
void
BreakpointList::Dump (Stream *s) const
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
s->Printf("%p: ", static_cast<const void*>(this));
s->Indent();
s->Printf("BreakpointList with %u Breakpoints:\n", (uint32_t)m_breakpoints.size());
@@ -180,7 +177,7 @@ BreakpointList::Dump (Stream *s) const
BreakpointSP
BreakpointList::GetBreakpointAtIndex (size_t i)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
BreakpointSP stop_sp;
bp_collection::iterator end = m_breakpoints.end();
bp_collection::iterator pos;
@@ -196,7 +193,7 @@ BreakpointList::GetBreakpointAtIndex (size_t i)
const BreakpointSP
BreakpointList::GetBreakpointAtIndex (size_t i) const
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
BreakpointSP stop_sp;
bp_collection::const_iterator end = m_breakpoints.end();
bp_collection::const_iterator pos;
@@ -212,7 +209,7 @@ BreakpointList::GetBreakpointAtIndex (size_t i) const
void
BreakpointList::UpdateBreakpoints (ModuleList& module_list, bool added, bool delete_locations)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
for (const auto &bp_sp : m_breakpoints)
bp_sp->ModulesChanged (module_list, added, delete_locations);
@@ -221,7 +218,7 @@ BreakpointList::UpdateBreakpoints (ModuleList& module_list, bool added, bool del
void
BreakpointList::UpdateBreakpointsWhenModuleIsReplaced (ModuleSP old_module_sp, ModuleSP new_module_sp)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
for (const auto &bp_sp : m_breakpoints)
bp_sp->ModuleReplaced (old_module_sp, new_module_sp);
@@ -230,14 +227,14 @@ BreakpointList::UpdateBreakpointsWhenModuleIsReplaced (ModuleSP old_module_sp, M
void
BreakpointList::ClearAllBreakpointSites ()
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
for (const auto &bp_sp : m_breakpoints)
bp_sp->ClearAllBreakpointSites ();
}
void
-BreakpointList::GetListMutex (Mutex::Locker &locker)
+BreakpointList::GetListMutex(std::unique_lock<std::recursive_mutex> &lock)
{
- return locker.Lock (m_mutex);
+ lock = std::unique_lock<std::recursive_mutex>(m_mutex);
}
diff --git a/source/Breakpoint/BreakpointLocation.cpp b/source/Breakpoint/BreakpointLocation.cpp
index 5ff91102aadd..5baf4721e826 100644
--- a/source/Breakpoint/BreakpointLocation.cpp
+++ b/source/Breakpoint/BreakpointLocation.cpp
@@ -19,6 +19,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/ValueObject.h"
+#include "lldb/Expression/DiagnosticManager.h"
#include "lldb/Expression/ExpressionVariable.h"
#include "lldb/Expression/UserExpression.h"
#include "lldb/Symbol/CompileUnit.h"
@@ -32,36 +33,29 @@
using namespace lldb;
using namespace lldb_private;
-BreakpointLocation::BreakpointLocation
-(
- break_id_t loc_id,
- Breakpoint &owner,
- const Address &addr,
- lldb::tid_t tid,
- bool hardware,
- bool check_for_resolver
-) :
- StoppointLocation (loc_id, addr.GetOpcodeLoadAddress(&owner.GetTarget()), hardware),
- m_being_created(true),
- m_should_resolve_indirect_functions (false),
- m_is_reexported (false),
- m_is_indirect (false),
- m_address (addr),
- m_owner (owner),
- m_options_ap (),
- m_bp_site_sp (),
- m_condition_mutex ()
+BreakpointLocation::BreakpointLocation(break_id_t loc_id, Breakpoint &owner, const Address &addr, lldb::tid_t tid,
+ bool hardware, bool check_for_resolver)
+ : StoppointLocation(loc_id, addr.GetOpcodeLoadAddress(&owner.GetTarget()), hardware),
+ m_being_created(true),
+ m_should_resolve_indirect_functions(false),
+ m_is_reexported(false),
+ m_is_indirect(false),
+ m_address(addr),
+ m_owner(owner),
+ m_options_ap(),
+ m_bp_site_sp(),
+ m_condition_mutex()
{
if (check_for_resolver)
{
Symbol *symbol = m_address.CalculateSymbolContextSymbol();
if (symbol && symbol->IsIndirect())
{
- SetShouldResolveIndirectFunctions (true);
+ SetShouldResolveIndirectFunctions(true);
}
}
-
- SetThreadID (tid);
+
+ SetThreadID(tid);
m_being_created = false;
}
@@ -266,9 +260,9 @@ bool
BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
-
- Mutex::Locker evaluation_locker(m_condition_mutex);
-
+
+ std::lock_guard<std::mutex> guard(m_condition_mutex);
+
size_t condition_hash;
const char *condition_text = GetConditionText(&condition_hash);
@@ -277,10 +271,10 @@ BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
m_user_expression_sp.reset();
return false;
}
-
- if (condition_hash != m_condition_hash ||
- !m_user_expression_sp ||
- !m_user_expression_sp->MatchesContext(exe_ctx))
+
+ DiagnosticManager diagnostics;
+
+ if (condition_hash != m_condition_hash || !m_user_expression_sp || !m_user_expression_sp->MatchesContext(exe_ctx))
{
LanguageType language = eLanguageTypeUnknown;
// See if we can figure out the language from the frame, otherwise use the default language:
@@ -303,20 +297,14 @@ BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
return true;
}
- StreamString errors;
-
- if (!m_user_expression_sp->Parse(errors,
- exe_ctx,
- eExecutionPolicyOnlyWhenNeeded,
- true,
- false))
+ if (!m_user_expression_sp->Parse(diagnostics, exe_ctx, eExecutionPolicyOnlyWhenNeeded, true, false))
{
error.SetErrorStringWithFormat("Couldn't parse conditional expression:\n%s",
- errors.GetData());
+ diagnostics.GetString().c_str());
m_user_expression_sp.reset();
return false;
}
-
+
m_condition_hash = condition_hash;
}
@@ -329,20 +317,17 @@ BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
options.SetUnwindOnError(true);
options.SetIgnoreBreakpoints(true);
options.SetTryAllThreads(true);
-
+ options.SetResultIsInternal(true); // Don't generate a user variable for condition expressions.
+
Error expr_error;
-
- StreamString execution_errors;
-
+
+ diagnostics.Clear();
+
ExpressionVariableSP result_variable_sp;
-
+
ExpressionResults result_code =
- m_user_expression_sp->Execute(execution_errors,
- exe_ctx,
- options,
- m_user_expression_sp,
- result_variable_sp);
-
+ m_user_expression_sp->Execute(diagnostics, exe_ctx, options, m_user_expression_sp, result_variable_sp);
+
bool ret;
if (result_code == eExpressionCompleted)
@@ -382,9 +367,9 @@ BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
else
{
ret = false;
- error.SetErrorStringWithFormat("Couldn't execute expression:\n%s", execution_errors.GetData());
+ error.SetErrorStringWithFormat("Couldn't execute expression:\n%s", diagnostics.GetString().c_str());
}
-
+
return ret;
}
diff --git a/source/Breakpoint/BreakpointLocationCollection.cpp b/source/Breakpoint/BreakpointLocationCollection.cpp
index 5b6e746f911d..52698b2f15bb 100644
--- a/source/Breakpoint/BreakpointLocationCollection.cpp
+++ b/source/Breakpoint/BreakpointLocationCollection.cpp
@@ -26,7 +26,8 @@ using namespace lldb_private;
// BreakpointLocationCollection constructor
//----------------------------------------------------------------------
BreakpointLocationCollection::BreakpointLocationCollection() :
- m_break_loc_collection()
+ m_break_loc_collection(),
+ m_collection_mutex()
{
}
@@ -40,6 +41,7 @@ BreakpointLocationCollection::~BreakpointLocationCollection()
void
BreakpointLocationCollection::Add(const BreakpointLocationSP &bp_loc)
{
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
BreakpointLocationSP old_bp_loc = FindByIDPair (bp_loc->GetBreakpoint().GetID(), bp_loc->GetID());
if (!old_bp_loc.get())
m_break_loc_collection.push_back(bp_loc);
@@ -48,6 +50,7 @@ BreakpointLocationCollection::Add(const BreakpointLocationSP &bp_loc)
bool
BreakpointLocationCollection::Remove (lldb::break_id_t bp_id, lldb::break_id_t bp_loc_id)
{
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
collection::iterator pos = GetIDPairIterator(bp_id, bp_loc_id); // Predicate
if (pos != m_break_loc_collection.end())
{
@@ -117,6 +120,7 @@ BreakpointLocationCollection::FindByIDPair (lldb::break_id_t break_id, lldb::bre
BreakpointLocationSP
BreakpointLocationCollection::GetByIndex (size_t i)
{
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
BreakpointLocationSP stop_sp;
if (i < m_break_loc_collection.size())
stop_sp = m_break_loc_collection[i];
@@ -127,6 +131,7 @@ BreakpointLocationCollection::GetByIndex (size_t i)
const BreakpointLocationSP
BreakpointLocationCollection::GetByIndex (size_t i) const
{
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
BreakpointLocationSP stop_sp;
if (i < m_break_loc_collection.size())
stop_sp = m_break_loc_collection[i];
@@ -156,6 +161,7 @@ BreakpointLocationCollection::ShouldStop (StoppointCallbackContext *context)
bool
BreakpointLocationCollection::ValidForThisThread (Thread *thread)
{
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
collection::iterator pos,
begin = m_break_loc_collection.begin(),
end = m_break_loc_collection.end();
@@ -171,6 +177,7 @@ BreakpointLocationCollection::ValidForThisThread (Thread *thread)
bool
BreakpointLocationCollection::IsInternal () const
{
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
collection::const_iterator pos,
begin = m_break_loc_collection.begin(),
end = m_break_loc_collection.end();
@@ -191,6 +198,7 @@ BreakpointLocationCollection::IsInternal () const
void
BreakpointLocationCollection::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
+ std::lock_guard<std::mutex> guard(m_collection_mutex);
collection::iterator pos,
begin = m_break_loc_collection.begin(),
end = m_break_loc_collection.end();
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;
}
diff --git a/source/Breakpoint/BreakpointResolver.cpp b/source/Breakpoint/BreakpointResolver.cpp
index f02eadf86a7c..e757b388550f 100644
--- a/source/Breakpoint/BreakpointResolver.cpp
+++ b/source/Breakpoint/BreakpointResolver.cpp
@@ -32,8 +32,9 @@ using namespace lldb;
//----------------------------------------------------------------------
// BreakpointResolver:
//----------------------------------------------------------------------
-BreakpointResolver::BreakpointResolver (Breakpoint *bkpt, const unsigned char resolverTy) :
+BreakpointResolver::BreakpointResolver (Breakpoint *bkpt, const unsigned char resolverTy, lldb::addr_t offset) :
m_breakpoint (bkpt),
+ m_offset(offset),
SubclassID (resolverTy)
{
}
@@ -74,6 +75,7 @@ BreakpointResolver::SetSCMatchesByLine (SearchFilter &filter, SymbolContextList
bool first_entry = true;
FileSpec match_file_spec;
+ FileSpec match_original_file_spec;
uint32_t closest_line_number = UINT32_MAX;
// Pull out the first entry, and all the others that match its file spec, and stuff them in the tmp list.
@@ -85,11 +87,13 @@ BreakpointResolver::SetSCMatchesByLine (SearchFilter &filter, SymbolContextList
if (first_entry)
{
match_file_spec = sc.line_entry.file;
+ match_original_file_spec = sc.line_entry.original_file;
matches = true;
first_entry = false;
}
else
- matches = (sc.line_entry.file == match_file_spec);
+ matches = ((sc.line_entry.file == match_file_spec) ||
+ (sc.line_entry.original_file == match_original_file_spec));
if (matches)
{
@@ -176,7 +180,7 @@ BreakpointResolver::SetSCMatchesByLine (SearchFilter &filter, SymbolContextList
}
}
- BreakpointLocationSP bp_loc_sp (m_breakpoint->AddLocation(line_start));
+ BreakpointLocationSP bp_loc_sp (AddLocation(line_start));
if (log && bp_loc_sp && !m_breakpoint->IsInternal())
{
StreamString s;
@@ -202,3 +206,22 @@ BreakpointResolver::SetSCMatchesByLine (SearchFilter &filter, SymbolContextList
}
}
}
+
+BreakpointLocationSP
+BreakpointResolver::AddLocation(Address loc_addr, bool *new_location)
+{
+ loc_addr.Slide(m_offset);
+ return m_breakpoint->AddLocation(loc_addr, new_location);
+}
+
+
+void
+BreakpointResolver::SetOffset (lldb::addr_t offset)
+{
+ // There may already be an offset, so we are actually adjusting location addresses by the difference.
+ // lldb::addr_t slide = offset - m_offset;
+ // FIXME: We should go fix up all the already set locations for the new slide.
+
+ m_offset = offset;
+}
+
diff --git a/source/Breakpoint/BreakpointResolverAddress.cpp b/source/Breakpoint/BreakpointResolverAddress.cpp
index 8a0469a07e46..14942014d80a 100644
--- a/source/Breakpoint/BreakpointResolverAddress.cpp
+++ b/source/Breakpoint/BreakpointResolverAddress.cpp
@@ -121,8 +121,8 @@ BreakpointResolverAddress::SearchCallback
}
}
- BreakpointLocationSP bp_loc_sp(m_breakpoint->AddLocation(m_addr));
m_resolved_addr = m_addr.GetLoadAddress(&m_breakpoint->GetTarget());
+ BreakpointLocationSP bp_loc_sp(AddLocation(m_addr));
if (bp_loc_sp && !m_breakpoint->IsInternal())
{
StreamString s;
diff --git a/source/Breakpoint/BreakpointResolverFileLine.cpp b/source/Breakpoint/BreakpointResolverFileLine.cpp
index 408998ec83ab..e1fb87a9d872 100644
--- a/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -31,11 +31,12 @@ BreakpointResolverFileLine::BreakpointResolverFileLine
Breakpoint *bkpt,
const FileSpec &file_spec,
uint32_t line_no,
+ lldb::addr_t offset,
bool check_inlines,
bool skip_prologue,
bool exact_match
) :
- BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver),
+ BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver, offset),
m_file_spec (file_spec),
m_line_number (line_no),
m_inlines (check_inlines),
@@ -117,6 +118,7 @@ BreakpointResolverFileLine::CopyForBreakpoint (Breakpoint &breakpoint)
lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileLine(&breakpoint,
m_file_spec,
m_line_number,
+ m_offset,
m_inlines,
m_skip_prologue,
m_exact_match));
diff --git a/source/Breakpoint/BreakpointResolverFileRegex.cpp b/source/Breakpoint/BreakpointResolverFileRegex.cpp
index e7bce0524c57..ae7f58acb91e 100644
--- a/source/Breakpoint/BreakpointResolverFileRegex.cpp
+++ b/source/Breakpoint/BreakpointResolverFileRegex.cpp
@@ -30,11 +30,13 @@ BreakpointResolverFileRegex::BreakpointResolverFileRegex
(
Breakpoint *bkpt,
RegularExpression &regex,
+ const std::unordered_set<std::string> &func_names,
bool exact_match
) :
BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver),
m_regex (regex),
- m_exact_match (exact_match)
+ m_exact_match (exact_match),
+ m_function_names(func_names)
{
}
@@ -68,6 +70,32 @@ BreakpointResolverFileRegex::SearchCallback
const bool search_inlines = false;
cu->ResolveSymbolContext (cu_file_spec, line_matches[i], search_inlines, m_exact_match, eSymbolContextEverything, sc_list);
+ // Find all the function names:
+ if (!m_function_names.empty())
+ {
+ std::vector<size_t> sc_to_remove;
+ for (size_t i = 0; i < sc_list.GetSize(); i++)
+ {
+ SymbolContext sc_ctx;
+ sc_list.GetContextAtIndex(i, sc_ctx);
+ std::string name(sc_ctx.GetFunctionName(Mangled::NamePreference::ePreferDemangledWithoutArguments).AsCString());
+ if (!m_function_names.count(name))
+ {
+ sc_to_remove.push_back(i);
+ }
+ }
+
+ if (!sc_to_remove.empty())
+ {
+ std::vector<size_t>::reverse_iterator iter;
+ std::vector<size_t>::reverse_iterator rend = sc_to_remove.rend();
+ for (iter = sc_to_remove.rbegin(); iter != rend; iter++)
+ {
+ sc_list.RemoveContextAtIndex(*iter);
+ }
+ }
+ }
+
const bool skip_prologue = true;
BreakpointResolver::SetSCMatchesByLine (filter, sc_list, skip_prologue, m_regex.GetText());
@@ -98,7 +126,13 @@ BreakpointResolverFileRegex::Dump (Stream *s) const
lldb::BreakpointResolverSP
BreakpointResolverFileRegex::CopyForBreakpoint (Breakpoint &breakpoint)
{
- lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileRegex(&breakpoint, m_regex, m_exact_match));
+ lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileRegex(&breakpoint, m_regex, m_function_names, m_exact_match));
return ret_sp;
}
+void
+BreakpointResolverFileRegex::AddFunctionName(const char *func_name)
+{
+ m_function_names.insert(func_name);
+}
+
diff --git a/source/Breakpoint/BreakpointResolverName.cpp b/source/Breakpoint/BreakpointResolverName.cpp
index 9ae3fe5256d4..dfa09c2342f9 100644
--- a/source/Breakpoint/BreakpointResolverName.cpp
+++ b/source/Breakpoint/BreakpointResolverName.cpp
@@ -22,6 +22,7 @@
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "Plugins/Language/ObjC/ObjCLanguage.h"
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
using namespace lldb;
using namespace lldb_private;
@@ -31,8 +32,9 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
uint32_t name_type_mask,
LanguageType language,
Breakpoint::MatchType type,
+ lldb::addr_t offset,
bool skip_prologue) :
- BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
+ BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
m_class_name (),
m_regex (),
m_match_type (type),
@@ -60,8 +62,9 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
size_t num_names,
uint32_t name_type_mask,
LanguageType language,
+ lldb::addr_t offset,
bool skip_prologue) :
- BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
+ BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
m_match_type (Breakpoint::Exact),
m_language (language),
m_skip_prologue (skip_prologue)
@@ -76,8 +79,9 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
std::vector<std::string> names,
uint32_t name_type_mask,
LanguageType language,
+ lldb::addr_t offset,
bool skip_prologue) :
- BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
+ BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
m_match_type (Breakpoint::Exact),
m_language (language),
m_skip_prologue (skip_prologue)
@@ -91,8 +95,9 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
RegularExpression &func_regex,
lldb::LanguageType language,
+ lldb::addr_t offset,
bool skip_prologue) :
- BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
+ BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
m_class_name (nullptr),
m_regex (func_regex),
m_match_type (Breakpoint::Regexp),
@@ -101,30 +106,33 @@ BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
{
}
-BreakpointResolverName::BreakpointResolverName(Breakpoint *bkpt,
- const char *class_name,
- const char *method,
- Breakpoint::MatchType type,
- bool skip_prologue ) :
- BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
+BreakpointResolverName::BreakpointResolverName
+(
+ Breakpoint *bkpt,
+ const char *class_name,
+ const char *method,
+ Breakpoint::MatchType type,
+ lldb::addr_t offset,
+ bool skip_prologue
+) :
+ BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
m_class_name (class_name),
m_regex (),
m_match_type (type),
m_language (eLanguageTypeUnknown),
m_skip_prologue (skip_prologue)
{
- LookupInfo lookup;
- lookup.name.SetCString(method);
- lookup.lookup_name = lookup.name;
- lookup.name_type_mask = eFunctionNameTypeMethod;
- lookup.match_name_after_lookup = false;
+ Module::LookupInfo lookup;
+ lookup.SetName(ConstString(method));
+ lookup.SetLookupName(lookup.GetName());
+ lookup.SetNameTypeMask(eFunctionNameTypeMethod);
m_lookups.push_back (lookup);
}
BreakpointResolverName::~BreakpointResolverName() = default;
BreakpointResolverName::BreakpointResolverName(const BreakpointResolverName &rhs) :
- BreakpointResolver(rhs.m_breakpoint, BreakpointResolver::NameResolver),
+ BreakpointResolver(rhs.m_breakpoint, BreakpointResolver::NameResolver, rhs.m_offset),
m_lookups(rhs.m_lookups),
m_class_name(rhs.m_class_name),
m_regex(rhs.m_regex),
@@ -144,47 +152,20 @@ BreakpointResolverName::AddNameLookup (const ConstString &name, uint32_t name_ty
objc_method.GetFullNames(objc_names, true);
for (ConstString objc_name : objc_names)
{
- LookupInfo lookup;
- lookup.name = name;
- lookup.lookup_name = objc_name;
- lookup.name_type_mask = eFunctionNameTypeFull;
- lookup.match_name_after_lookup = false;
+ Module::LookupInfo lookup;
+ lookup.SetName(name);
+ lookup.SetLookupName(objc_name);
+ lookup.SetNameTypeMask(eFunctionNameTypeFull);
m_lookups.push_back (lookup);
}
}
else
{
- LookupInfo lookup;
- lookup.name = name;
- Module::PrepareForFunctionNameLookup(lookup.name, name_type_mask, m_language, lookup.lookup_name, lookup.name_type_mask, lookup.match_name_after_lookup);
+ Module::LookupInfo lookup(name, name_type_mask, m_language);
m_lookups.push_back (lookup);
}
}
-void
-BreakpointResolverName::LookupInfo::Prune (SymbolContextList &sc_list, size_t start_idx) const
-{
- if (match_name_after_lookup && name)
- {
- SymbolContext sc;
- size_t i = start_idx;
- while (i < sc_list.GetSize())
- {
- if (!sc_list.GetContextAtIndex(i, sc))
- break;
- ConstString full_name (sc.GetFunctionName());
- if (full_name && ::strstr(full_name.GetCString(), name.GetCString()) == nullptr)
- {
- sc_list.RemoveContextAtIndex(i);
- }
- else
- {
- ++i;
- }
- }
- }
-}
-
// FIXME: Right now we look at the module level, and call the module's "FindFunctions".
// Greg says he will add function tables, maybe at the CompileUnit level to accelerate function
// lookup. At that point, we should switch the depth to CompileUnit, and look in these tables.
@@ -222,16 +203,17 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
case Breakpoint::Exact:
if (context.module_sp)
{
- for (const LookupInfo &lookup : m_lookups)
+ for (const auto &lookup : m_lookups)
{
const size_t start_func_idx = func_list.GetSize();
- context.module_sp->FindFunctions(lookup.lookup_name,
+ context.module_sp->FindFunctions(lookup.GetLookupName(),
nullptr,
- lookup.name_type_mask,
+ lookup.GetNameTypeMask(),
include_symbols,
include_inlines,
append,
func_list);
+
const size_t end_func_idx = func_list.GetSize();
if (start_func_idx < end_func_idx)
@@ -344,7 +326,7 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
{
if (filter.AddressPasses(break_addr))
{
- BreakpointLocationSP bp_loc_sp (m_breakpoint->AddLocation(break_addr, &new_location));
+ BreakpointLocationSP bp_loc_sp (AddLocation(break_addr, &new_location));
bp_loc_sp->SetIsReExported(is_reexported);
if (bp_loc_sp && new_location && !m_breakpoint->IsInternal())
{
@@ -379,15 +361,15 @@ BreakpointResolverName::GetDescription (Stream *s)
{
size_t num_names = m_lookups.size();
if (num_names == 1)
- s->Printf("name = '%s'", m_lookups[0].name.GetCString());
+ s->Printf("name = '%s'", m_lookups[0].GetName().GetCString());
else
{
s->Printf("names = {");
- for (size_t i = 0; i < num_names - 1; i++)
+ for (size_t i = 0; i < num_names; i++)
{
- s->Printf ("'%s', ", m_lookups[i].name.GetCString());
+ s->Printf ("%s'%s'", (i == 0 ? "" : ", "), m_lookups[i].GetName().GetCString());
}
- s->Printf ("'%s'}", m_lookups[num_names - 1].name.GetCString());
+ s->Printf ("}");
}
}
if (m_language != eLanguageTypeUnknown)
diff --git a/source/Breakpoint/BreakpointSite.cpp b/source/Breakpoint/BreakpointSite.cpp
index d2aaea098cdb..b4112f7fc012 100644
--- a/source/Breakpoint/BreakpointSite.cpp
+++ b/source/Breakpoint/BreakpointSite.cpp
@@ -23,17 +23,15 @@
using namespace lldb;
using namespace lldb_private;
-BreakpointSite::BreakpointSite(BreakpointSiteList *list,
- const BreakpointLocationSP& owner,
- lldb::addr_t addr,
- bool use_hardware) :
- StoppointLocation(GetNextID(), addr, 0, use_hardware),
- m_type (eSoftware), // Process subclasses need to set this correctly using SetType()
- m_saved_opcode(),
- m_trap_opcode(),
- m_enabled(false), // Need to create it disabled, so the first enable turns it on.
- m_owners(),
- m_owners_mutex(Mutex::eMutexTypeRecursive)
+BreakpointSite::BreakpointSite(BreakpointSiteList *list, const BreakpointLocationSP &owner, lldb::addr_t addr,
+ bool use_hardware)
+ : StoppointLocation(GetNextID(), addr, 0, use_hardware),
+ m_type(eSoftware), // Process subclasses need to set this correctly using SetType()
+ m_saved_opcode(),
+ m_trap_opcode(),
+ m_enabled(false), // Need to create it disabled, so the first enable turns it on.
+ m_owners(),
+ m_owners_mutex()
{
m_owners.Add(owner);
}
@@ -61,7 +59,7 @@ BreakpointSite::GetNextID()
bool
BreakpointSite::ShouldStop (StoppointCallbackContext *context)
{
- Mutex::Locker locker(m_owners_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
IncrementHitCount();
return m_owners.ShouldStop (context);
}
@@ -69,7 +67,7 @@ BreakpointSite::ShouldStop (StoppointCallbackContext *context)
bool
BreakpointSite::IsBreakpointAtThisSite (lldb::break_id_t bp_id)
{
- Mutex::Locker locker(m_owners_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
const size_t owner_count = m_owners.GetSize();
for (size_t i = 0; i < owner_count; i++)
{
@@ -96,7 +94,7 @@ BreakpointSite::Dump(Stream *s) const
void
BreakpointSite::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
- Mutex::Locker locker(m_owners_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
if (level != lldb::eDescriptionLevelBrief)
s->Printf ("breakpoint site: %d at 0x%8.8" PRIx64, GetID(), GetLoadAddress());
m_owners.GetDescription (s, level);
@@ -166,14 +164,14 @@ BreakpointSite::SetEnabled (bool enabled)
void
BreakpointSite::AddOwner (const BreakpointLocationSP &owner)
{
- Mutex::Locker locker(m_owners_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
m_owners.Add(owner);
}
size_t
BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
{
- Mutex::Locker locker(m_owners_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
m_owners.Remove(break_id, break_loc_id);
return m_owners.GetSize();
}
@@ -181,28 +179,28 @@ BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_l
size_t
BreakpointSite::GetNumberOfOwners ()
{
- Mutex::Locker locker(m_owners_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
return m_owners.GetSize();
}
BreakpointLocationSP
BreakpointSite::GetOwnerAtIndex (size_t index)
{
- Mutex::Locker locker(m_owners_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
return m_owners.GetByIndex (index);
}
bool
BreakpointSite::ValidForThisThread (Thread *thread)
{
- Mutex::Locker locker(m_owners_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
return m_owners.ValidForThisThread(thread);
}
void
BreakpointSite::BumpHitCounts()
{
- Mutex::Locker locker(m_owners_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations())
{
loc_sp->BumpHitCount();
@@ -255,7 +253,7 @@ BreakpointSite::IntersectsRange(lldb::addr_t addr, size_t size, lldb::addr_t *in
size_t
BreakpointSite::CopyOwnersList (BreakpointLocationCollection &out_collection)
{
- Mutex::Locker locker(m_owners_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations())
{
out_collection.Add(loc_sp);
diff --git a/source/Breakpoint/BreakpointSiteList.cpp b/source/Breakpoint/BreakpointSiteList.cpp
index 1eaadb62a384..de9a5ad0b310 100644
--- a/source/Breakpoint/BreakpointSiteList.cpp
+++ b/source/Breakpoint/BreakpointSiteList.cpp
@@ -19,9 +19,7 @@
using namespace lldb;
using namespace lldb_private;
-BreakpointSiteList::BreakpointSiteList() :
- m_mutex (Mutex::eMutexTypeRecursive),
- m_bp_site_list()
+BreakpointSiteList::BreakpointSiteList() : m_mutex(), m_bp_site_list()
{
}
@@ -36,7 +34,7 @@ lldb::break_id_t
BreakpointSiteList::Add(const BreakpointSiteSP &bp)
{
lldb::addr_t bp_site_load_addr = bp->GetLoadAddress();
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::iterator iter = m_bp_site_list.find (bp_site_load_addr);
if (iter == m_bp_site_list.end())
@@ -81,7 +79,7 @@ BreakpointSiteList::FindIDByAddress (lldb::addr_t addr)
bool
BreakpointSiteList::Remove (lldb::break_id_t break_id)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::iterator pos = GetIDIterator(break_id); // Predicate
if (pos != m_bp_site_list.end())
{
@@ -94,7 +92,7 @@ BreakpointSiteList::Remove (lldb::break_id_t break_id)
bool
BreakpointSiteList::RemoveByAddress (lldb::addr_t address)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::iterator pos = m_bp_site_list.find(address);
if (pos != m_bp_site_list.end())
{
@@ -124,7 +122,7 @@ private:
BreakpointSiteList::collection::iterator
BreakpointSiteList::GetIDIterator (lldb::break_id_t break_id)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range
BreakpointSiteIDMatches(break_id)); // Predicate
}
@@ -132,7 +130,7 @@ BreakpointSiteList::GetIDIterator (lldb::break_id_t break_id)
BreakpointSiteList::collection::const_iterator
BreakpointSiteList::GetIDConstIterator (lldb::break_id_t break_id) const
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range
BreakpointSiteIDMatches(break_id)); // Predicate
}
@@ -140,7 +138,7 @@ BreakpointSiteList::GetIDConstIterator (lldb::break_id_t break_id) const
BreakpointSiteSP
BreakpointSiteList::FindByID (lldb::break_id_t break_id)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
BreakpointSiteSP stop_sp;
collection::iterator pos = GetIDIterator(break_id);
if (pos != m_bp_site_list.end())
@@ -152,7 +150,7 @@ BreakpointSiteList::FindByID (lldb::break_id_t break_id)
const BreakpointSiteSP
BreakpointSiteList::FindByID (lldb::break_id_t break_id) const
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
BreakpointSiteSP stop_sp;
collection::const_iterator pos = GetIDConstIterator(break_id);
if (pos != m_bp_site_list.end())
@@ -165,7 +163,7 @@ BreakpointSiteSP
BreakpointSiteList::FindByAddress (lldb::addr_t addr)
{
BreakpointSiteSP found_sp;
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::iterator iter = m_bp_site_list.find(addr);
if (iter != m_bp_site_list.end())
found_sp = iter->second;
@@ -175,7 +173,7 @@ BreakpointSiteList::FindByAddress (lldb::addr_t addr)
bool
BreakpointSiteList::BreakpointSiteContainsBreakpoint (lldb::break_id_t bp_site_id, lldb::break_id_t bp_id)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::const_iterator pos = GetIDConstIterator(bp_site_id);
if (pos != m_bp_site_list.end())
return pos->second->IsBreakpointAtThisSite (bp_id);
@@ -200,7 +198,7 @@ BreakpointSiteList::Dump (Stream *s) const
void
BreakpointSiteList::ForEach (std::function <void(BreakpointSite *)> const &callback)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
for (auto pair : m_bp_site_list)
callback (pair.second.get());
}
@@ -210,8 +208,8 @@ BreakpointSiteList::FindInRange (lldb::addr_t lower_bound, lldb::addr_t upper_bo
{
if (lower_bound > upper_bound)
return false;
-
- Mutex::Locker locker(m_mutex);
+
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
collection::const_iterator lower, upper, pos;
lower = m_bp_site_list.lower_bound(lower_bound);
if (lower == m_bp_site_list.end()
diff --git a/source/Breakpoint/Makefile b/source/Breakpoint/Makefile
deleted file mode 100644
index 223e4c24465f..000000000000
--- a/source/Breakpoint/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-##===- source/Breakpoint/Makefile --------------------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LLDB_LEVEL := ../..
-LIBRARYNAME := lldbBreakpoint
-BUILD_ARCHIVE = 1
-
-include $(LLDB_LEVEL)/Makefile
diff --git a/source/Breakpoint/WatchpointList.cpp b/source/Breakpoint/WatchpointList.cpp
index 64bf5cd63ed0..f662c24cecee 100644
--- a/source/Breakpoint/WatchpointList.cpp
+++ b/source/Breakpoint/WatchpointList.cpp
@@ -18,10 +18,7 @@
using namespace lldb;
using namespace lldb_private;
-WatchpointList::WatchpointList() :
- m_watchpoints (),
- m_mutex (Mutex::eMutexTypeRecursive),
- m_next_wp_id (0)
+WatchpointList::WatchpointList() : m_watchpoints(), m_mutex(), m_next_wp_id(0)
{
}
@@ -33,7 +30,7 @@ WatchpointList::~WatchpointList()
lldb::watch_id_t
WatchpointList::Add (const WatchpointSP &wp_sp, bool notify)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
wp_sp->SetID(++m_next_wp_id);
m_watchpoints.push_back(wp_sp);
if (notify)
@@ -54,7 +51,7 @@ WatchpointList::Dump (Stream *s) const
void
WatchpointList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
s->Printf("%p: ", static_cast<const void*>(this));
//s->Indent();
s->Printf("WatchpointList with %" PRIu64 " Watchpoints:\n",
@@ -70,7 +67,7 @@ const WatchpointSP
WatchpointList::FindByAddress (lldb::addr_t addr) const
{
WatchpointSP wp_sp;
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (!m_watchpoints.empty())
{
wp_collection::const_iterator pos, end = m_watchpoints.end();
@@ -93,7 +90,7 @@ const WatchpointSP
WatchpointList::FindBySpec (std::string spec) const
{
WatchpointSP wp_sp;
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (!m_watchpoints.empty())
{
wp_collection::const_iterator pos, end = m_watchpoints.end();
@@ -142,7 +139,7 @@ WatchpointSP
WatchpointList::FindByID (lldb::watch_id_t watch_id) const
{
WatchpointSP wp_sp;
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
wp_collection::const_iterator pos = GetIDConstIterator(watch_id);
if (pos != m_watchpoints.end())
wp_sp = *pos;
@@ -175,7 +172,7 @@ WatchpointList::FindIDBySpec (std::string spec)
WatchpointSP
WatchpointList::GetByIndex (uint32_t i)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
WatchpointSP wp_sp;
if (i < m_watchpoints.size())
{
@@ -189,7 +186,7 @@ WatchpointList::GetByIndex (uint32_t i)
const WatchpointSP
WatchpointList::GetByIndex (uint32_t i) const
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
WatchpointSP wp_sp;
if (i < m_watchpoints.size())
{
@@ -213,7 +210,7 @@ WatchpointList::GetWatchpointIDs() const
bool
WatchpointList::Remove (lldb::watch_id_t watch_id, bool notify)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
wp_collection::iterator pos = GetIDIterator(watch_id);
if (pos != m_watchpoints.end())
{
@@ -234,7 +231,7 @@ uint32_t
WatchpointList::GetHitCount () const
{
uint32_t hit_count = 0;
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
wp_collection::const_iterator pos, end = m_watchpoints.end();
for (pos = m_watchpoints.begin(); pos != end; ++pos)
hit_count += (*pos)->GetHitCount();
@@ -261,7 +258,7 @@ WatchpointList::ShouldStop (StoppointCallbackContext *context, lldb::watch_id_t
void
WatchpointList::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
- Mutex::Locker locker (m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
wp_collection::iterator pos, end = m_watchpoints.end();
for (pos = m_watchpoints.begin(); pos != end; ++pos)
@@ -274,7 +271,7 @@ WatchpointList::GetDescription (Stream *s, lldb::DescriptionLevel level)
void
WatchpointList::SetEnabledAll (bool enabled)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
wp_collection::iterator pos, end = m_watchpoints.end();
for (pos = m_watchpoints.begin(); pos != end; ++pos)
@@ -284,7 +281,7 @@ WatchpointList::SetEnabledAll (bool enabled)
void
WatchpointList::RemoveAll (bool notify)
{
- Mutex::Locker locker(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (notify)
{
@@ -305,7 +302,7 @@ WatchpointList::RemoveAll (bool notify)
}
void
-WatchpointList::GetListMutex (Mutex::Locker &locker)
+WatchpointList::GetListMutex(std::unique_lock<std::recursive_mutex> &lock)
{
- return locker.Lock (m_mutex);
+ lock = std::unique_lock<std::recursive_mutex>(m_mutex);
}