diff options
author | Jim Ingham <jingham@apple.com> | 2013-12-03 02:31:17 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2013-12-03 02:31:17 +0000 |
commit | 177553e4c08167ab63b8e7d4845a4a3f6ce283b9 (patch) | |
tree | a7cea7ebfe8130da45efcb365a18ecb94567b93f /lldb/source/Breakpoint/BreakpointLocationList.cpp | |
parent | 98b28a1eaa3ff788350303bac21d8cea046c542b (diff) | |
download | bcm5719-llvm-177553e4c08167ab63b8e7d4845a4a3f6ce283b9.tar.gz bcm5719-llvm-177553e4c08167ab63b8e7d4845a4a3f6ce283b9.zip |
Remove the bad assumption that breakpoint locations won't get deleted in BreakpointLocationList::FindByID.
<rdar://problem/15566148>
llvm-svn: 196197
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointLocationList.cpp')
-rw-r--r-- | lldb/source/Breakpoint/BreakpointLocationList.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lldb/source/Breakpoint/BreakpointLocationList.cpp b/lldb/source/Breakpoint/BreakpointLocationList.cpp index 8be3d9b67e2..0c4c54d2f16 100644 --- a/lldb/source/Breakpoint/BreakpointLocationList.cpp +++ b/lldb/source/Breakpoint/BreakpointLocationList.cpp @@ -77,19 +77,25 @@ BreakpointLocationList::FindIDByAddress (const Address &addr) return LLDB_INVALID_BREAK_ID; } +static bool +Compare (BreakpointLocationSP lhs, lldb::break_id_t val) +{ + return lhs->GetID() < val; +} + BreakpointLocationSP BreakpointLocationList::FindByID (lldb::break_id_t break_id) const { BreakpointLocationSP bp_loc_sp; Mutex::Locker locker (m_mutex); - // We never remove a breakpoint locations, so the ID can be translated into - // the location index by subtracting 1 - uint32_t idx = break_id - 1; - if (idx <= m_locations.size()) - { - bp_loc_sp = m_locations[idx]; - } - return bp_loc_sp; + + collection::const_iterator begin = m_locations.begin(), end = m_locations.end(); + collection::const_iterator result; + result = std::lower_bound(begin, end, break_id, Compare); + if (result == end) + return bp_loc_sp; + else + return *(result); } size_t |