summaryrefslogtreecommitdiffstats
path: root/lldb/source/Breakpoint/BreakpointLocationList.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-12-03 17:50:20 +0000
committerGreg Clayton <gclayton@apple.com>2013-12-03 17:50:20 +0000
commitc6b26f0545b247a55c9d8e6d0118b7662712f3a9 (patch)
tree9e868086d14f01bda8921ca4f3674c2dcf111c74 /lldb/source/Breakpoint/BreakpointLocationList.cpp
parent7371092d25ad321b0c14789bd4918b206d80b9f2 (diff)
downloadbcm5719-llvm-c6b26f0545b247a55c9d8e6d0118b7662712f3a9.tar.gz
bcm5719-llvm-c6b26f0545b247a55c9d8e6d0118b7662712f3a9.zip
<rdar://problem/15566148>
Fix use of std::lower_bound to check for equality if a match is found to ensure we don't return the next breakpoint with an ID greater than the break_id that was asked for. llvm-svn: 196298
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointLocationList.cpp')
-rw-r--r--lldb/source/Breakpoint/BreakpointLocationList.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/lldb/source/Breakpoint/BreakpointLocationList.cpp b/lldb/source/Breakpoint/BreakpointLocationList.cpp
index 0c4c54d2f16..18147deca3e 100644
--- a/lldb/source/Breakpoint/BreakpointLocationList.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocationList.cpp
@@ -86,16 +86,13 @@ Compare (BreakpointLocationSP lhs, lldb::break_id_t val)
BreakpointLocationSP
BreakpointLocationList::FindByID (lldb::break_id_t break_id) const
{
- BreakpointLocationSP bp_loc_sp;
Mutex::Locker locker (m_mutex);
-
- 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;
+ collection::const_iterator end = m_locations.end();
+ collection::const_iterator pos = std::lower_bound(m_locations.begin(), end, break_id, Compare);
+ if (pos != end && (*pos)->GetID() == break_id)
+ return *(pos);
else
- return *(result);
+ return BreakpointLocationSP();
}
size_t
OpenPOWER on IntegriCloud