diff options
| author | Jim Ingham <jingham@apple.com> | 2011-06-29 19:42:28 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2011-06-29 19:42:28 +0000 |
| commit | 20c771998b59d485e1857f72730e41d848dad555 (patch) | |
| tree | 4f07f540c91235a47a307438e3b2328d9585af6a /lldb/source/Breakpoint/BreakpointSiteList.cpp | |
| parent | e44914178866bcf1ecee169d5e29fe93be7a0d70 (diff) | |
| download | bcm5719-llvm-20c771998b59d485e1857f72730e41d848dad555.tar.gz bcm5719-llvm-20c771998b59d485e1857f72730e41d848dad555.zip | |
Remove a few more places where we were iterating linearly over the Breakpoint Site's rather than
looking up what we needed by address, which is much faster.
llvm-svn: 134090
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointSiteList.cpp')
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointSiteList.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lldb/source/Breakpoint/BreakpointSiteList.cpp b/lldb/source/Breakpoint/BreakpointSiteList.cpp index f3f10f06ed7..a8858f71d69 100644 --- a/lldb/source/Breakpoint/BreakpointSiteList.cpp +++ b/lldb/source/Breakpoint/BreakpointSiteList.cpp @@ -209,6 +209,41 @@ BreakpointSiteList::GetByIndex (uint32_t i) const return stop_sp; } +bool +BreakpointSiteList::FindInRange (lldb::addr_t lower_bound, lldb::addr_t upper_bound, BreakpointSiteList &bp_site_list) const +{ + + if (lower_bound > upper_bound) + return false; + + collection::const_iterator lower, upper, pos; + lower = m_bp_site_list.lower_bound(lower_bound); + if (lower == m_bp_site_list.end() + || (*lower).first >= upper_bound) + return false; + + // This is one tricky bit. The breakpoint might overlap the bottom end of the range. So we grab the + // breakpoint prior to the lower bound, and check that that + its byte size isn't in our range. + if (lower != m_bp_site_list.begin()) + { + collection::const_iterator prev_pos = lower; + prev_pos--; + const BreakpointSiteSP &prev_bp = (*prev_pos).second; + if (prev_bp->GetLoadAddress() + prev_bp->GetByteSize() > lower_bound) + bp_site_list.Add (prev_bp); + + } + + upper = m_bp_site_list.upper_bound(upper_bound); + + for (pos = lower; pos != upper; pos++) + { + bp_site_list.Add ((*pos).second); + } + return true; +} + + void BreakpointSiteList::SetEnabledForAll (const bool enabled, const lldb::break_id_t except_id) { |

