13 #include "llvm/Support/Errc.h"
18 static void NotifyChange(
const BreakpointSP &bp, BreakpointEventType event) {
19 Target &target = bp->GetTarget();
25 BreakpointList::BreakpointList(
bool is_internal)
26 : m_next_break_id(0), m_is_internal(is_internal) {}
31 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
41 return bp_sp->GetID();
45 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
47 auto it = std::find_if(
49 [&](
const BreakpointSP &bp) { return bp->GetID() == break_id; });
63 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
65 bp_sp->RemoveInvalidLocations(arch);
69 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
71 bp_sp->SetEnabled(enabled);
75 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
77 if (bp_sp->AllowDisable())
78 bp_sp->SetEnabled(enabled);
82 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
94 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
97 if (bp_sp->AllowDelete())
98 bp_sp->ClearAllBreakpointSites();
104 [&](
const BreakpointSP &bp) {
return bp->AllowDelete(); });
107 BreakpointList::bp_collection::iterator
111 [&](
const BreakpointSP &bp) { return bp->GetID() == break_id; });
114 BreakpointList::bp_collection::const_iterator
118 [&](
const BreakpointSP &bp) { return bp->GetID() == break_id; });
122 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
130 llvm::Expected<std::vector<lldb::BreakpointSP>>
133 return llvm::createStringError(llvm::errc::invalid_argument,
134 "FindBreakpointsByName requires a name");
138 return error.ToError();
140 std::vector<lldb::BreakpointSP> matching_bps;
142 if (bkpt_sp->MatchesName(name)) {
143 matching_bps.push_back(bkpt_sp);
151 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
152 s->
Printf(
"%p: ",
static_cast<const void *
>(
this));
154 s->
Printf(
"BreakpointList with %u Breakpoints:\n",
163 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
170 bool delete_locations) {
171 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
173 bp_sp->ModulesChanged(module_list, added, delete_locations);
177 ModuleSP old_module_sp, ModuleSP new_module_sp) {
178 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
180 bp_sp->ModuleReplaced(old_module_sp, new_module_sp);
184 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
186 bp_sp->ClearAllBreakpointSites();
190 std::unique_lock<std::recursive_mutex> &lock) {
191 lock = std::unique_lock<std::recursive_mutex>(
m_mutex);