9#ifndef LLDB_BREAKPOINT_STOPPOINTSITELIST_H
10#define LLDB_BREAKPOINT_STOPPOINTSITELIST_H
40 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
43 bool inserted =
m_site_list.try_emplace(site_load_addr, site_sp).second;
44 return inserted ? site_sp->GetID() :
UINT32_MAX;
51 s->
Printf(
"%p: ",
static_cast<const void *
>(
this));
52 s->
Printf(
"StopPointSiteList with %u ConstituentSites:\n",
55 typename collection::const_iterator pos;
56 typename collection::const_iterator end =
m_site_list.end();
72 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
73 typename collection::iterator iter =
m_site_list.find(addr);
75 found_sp = iter->second;
87 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
91 stop_sp = pos->second;
105 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
109 stop_sp = pos->second;
123 return site->GetID();
145 void ForEach(std::function<
void(StopPointSite *)>
const &callback) {
146 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
148 callback(pair.second.get());
158 bool Remove(
typename StopPointSite::SiteID site_id) {
159 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
176 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
177 typename collection::iterator pos =
m_site_list.find(addr);
187 if (lower_bound > upper_bound)
190 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
191 typename collection::const_iterator lower, upper, pos;
193 if (lower ==
m_site_list.end() || (*lower).first >= upper_bound)
200 typename collection::const_iterator prev_pos = lower;
203 if (prev_site->GetLoadAddress() + prev_site->GetByteSize() > lower_bound)
204 bp_site_list.
Add(prev_site);
209 for (pos = lower; pos != upper; pos++)
210 bp_site_list.
Add((*pos).second);
228 typename StopPointSite::SiteID site_id) {
233 return site_sp->ShouldStop(context);
245 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
250 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
254 std::vector<StopPointSiteSP>
Sites() {
255 std::vector<StopPointSiteSP> sites;
256 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
257 typename collection::iterator iter =
m_site_list.begin();
259 sites.push_back(iter->second);
267 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
274 typename collection::iterator
276 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
278 [site_id](
const std::pair<lldb::addr_t, StopPointSiteSP> s) {
279 return site_id == s.second->GetID();
286 typename collection::const_iterator
288 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
290 [site_id](
const std::pair<lldb::addr_t, StopPointSiteSP> s) {
291 return site_id == s.second->GetID();
A plug-in interface definition class for debugging a process.
collection::const_iterator GetIDConstIterator(typename StopPointSite::SiteID site_id) const
std::recursive_mutex m_mutex
void Dump(Stream *s) const
Standard Dump routine, doesn't do anything at present.
StopPointSite::SiteID Add(const StopPointSiteSP &site_sp)
Add a site to the list.
void ForEach(std::function< void(StopPointSite *)> const &callback)
bool FindInRange(lldb::addr_t lower_bound, lldb::addr_t upper_bound, StopPointSiteList &bp_site_list) const
StopPointSiteSP FindByID(typename StopPointSite::SiteID site_id)
Returns a shared pointer to the site with id site_id.
void(* StopPointSiteSPMapFunc)(StopPointSite &site, void *baton)
bool Remove(typename StopPointSite::SiteID site_id)
Removes the site given by site_id from this list.
StopPointSiteSP FindByAddress(lldb::addr_t addr)
Returns a shared pointer to the site at address addr.
collection::iterator GetIDIterator(typename StopPointSite::SiteID site_id)
std::vector< StopPointSiteSP > Sites()
const StopPointSiteSP FindByID(typename StopPointSite::SiteID site_id) const
Returns a shared pointer to the site with id site_id - const version.
bool RemoveByAddress(lldb::addr_t addr)
Removes the site at address addr from this list.
bool ShouldStop(StoppointCallbackContext *context, typename StopPointSite::SiteID site_id)
Enquires of the site on in this list with ID site_id whether we should stop for the constituent or no...
bool StopPointSiteContainsBreakpoint(typename StopPointSite::SiteID, lldb::break_id_t bp_id)
Returns whether the BreakpointSite site_id has a BreakpointLocation that is part of Breakpoint bp_id.
StopPointSite::SiteID FindIDByAddress(lldb::addr_t addr)
Returns the site id to the site at address addr.
size_t GetSize() const
Returns the number of elements in the list.
std::map< lldb::addr_t, StopPointSiteSP > collection
std::shared_ptr< StopPointSite > StopPointSiteSP
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
A stream class that can stream formatted output to a file.
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.
A class that represents a running process on the host machine.