13#include "llvm/Support/Errc.h"
19 Target &target = bp->GetTarget();
22 std::make_shared<Breakpoint::BreakpointEventData>(event, bp);
29 : m_next_break_id(0), m_is_internal(is_internal) {}
34 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
44 return bp_sp->GetID();
48 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
50 auto it = std::find_if(
52 [&](
const BreakpointSP &bp) { return bp->GetID() == break_id; });
66 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
68 bp_sp->RemoveInvalidLocations(arch);
72 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
74 bp_sp->SetEnabled(enabled);
78 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
80 if (bp_sp->AllowDisable())
81 bp_sp->SetEnabled(enabled);
85 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
97 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
100 if (bp_sp->AllowDelete())
101 bp_sp->ClearAllBreakpointSites();
107 [&](
const BreakpointSP &bp) {
return bp->AllowDelete(); });
110BreakpointList::bp_collection::iterator
114 [&](
const BreakpointSP &bp) { return bp->GetID() == break_id; });
117BreakpointList::bp_collection::const_iterator
121 [&](
const BreakpointSP &bp) { return bp->GetID() == break_id; });
125 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
133llvm::Expected<std::vector<lldb::BreakpointSP>>
136 return llvm::createStringError(llvm::errc::invalid_argument,
137 "FindBreakpointsByName requires a name");
141 return error.ToError();
143 std::vector<lldb::BreakpointSP> matching_bps;
145 if (bkpt_sp->MatchesName(name)) {
146 matching_bps.push_back(bkpt_sp);
154 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
155 s->
Printf(
"%p: ",
static_cast<const void *
>(
this));
157 s->
Printf(
"BreakpointList with %u Breakpoints:\n",
166 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
173 bool delete_locations) {
174 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
176 bp_sp->ModulesChanged(module_list, added, delete_locations);
181 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
183 bp_sp->ModuleReplaced(old_module_sp, new_module_sp);
187 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
189 bp_sp->ClearAllBreakpointSites();
193 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
195 bp_sp->ResetHitCount();
199 std::unique_lock<std::recursive_mutex> &lock) {
200 lock = std::unique_lock<std::recursive_mutex>(
m_mutex);
static void NotifyChange(const BreakpointSP &bp, BreakpointEventType event)
static llvm::raw_ostream & error(Stream &strm)
An architecture specification class.
static bool StringIsBreakpointName(llvm::StringRef str, Status &error)
Takes an input string and checks to see whether it is a breakpoint name.
BreakpointIterable Breakpoints()
void RemoveInvalidLocations(const ArchSpec &arch)
Removes all invalid breakpoint locations.
lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const
Returns a shared pointer to the breakpoint with id breakID.
bp_collection m_breakpoints
void GetListMutex(std::unique_lock< std::recursive_mutex > &lock)
Sets the passed in Locker to hold the Breakpoint List mutex.
bp_collection::const_iterator GetBreakpointIDConstIterator(lldb::break_id_t breakID) const
lldb::break_id_t Add(lldb::BreakpointSP &bp_sp, bool notify)
Add the breakpoint bp_sp to the list.
void SetEnabledAllowed(bool enabled)
bp_collection::iterator GetBreakpointIDIterator(lldb::break_id_t breakID)
BreakpointList(bool is_internal)
void ResetHitCounts()
Resets the hit count of all breakpoints.
void UpdateBreakpointsWhenModuleIsReplaced(lldb::ModuleSP old_module_sp, lldb::ModuleSP new_module_sp)
void RemoveAll(bool notify)
Removes all the breakpoints from this list.
void UpdateBreakpoints(ModuleList &module_list, bool load, bool delete_locations)
Tell all the breakpoints to update themselves due to a change in the modules in module_list.
void ClearAllBreakpointSites()
std::recursive_mutex m_mutex
llvm::Expected< std::vector< lldb::BreakpointSP > > FindBreakpointsByName(const char *name)
Find all the breakpoints with a given name.
void Dump(Stream *s) const
Standard "Dump" method. At present it does nothing.
bool Remove(lldb::break_id_t breakID, bool notify)
Removes the breakpoint given by breakID from this list.
lldb::break_id_t m_next_break_id
void RemoveAllowed(bool notify)
Removes all the breakpoints from this list - first checking the ePermDelete on the breakpoints.
lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const
Returns a shared pointer to the breakpoint with index i.
void SetEnabledAll(bool enabled)
bool EventTypeHasListeners(uint32_t event_type)
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
A collection class for Module objects.
A stream class that can stream formatted output to a file.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
@ eBroadcastBitBreakpointChanged
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::Module > ModuleSP