<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
This commit is contained in:
Greg Clayton 2013-12-03 17:50:20 +00:00
parent 7371092d25
commit c6b26f0545
1 changed files with 5 additions and 8 deletions

View File

@ -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