[Lldb-commits] [lldb] r196298 - <rdar://problem/15566148>

Greg Clayton gclayton at apple.com
Tue Dec 3 09:50:20 PST 2013


Author: gclayton
Date: Tue Dec  3 11:50:20 2013
New Revision: 196298

URL: http://llvm.org/viewvc/llvm-project?rev=196298&view=rev
Log:
<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.



Modified:
    lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp

Modified: lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp?rev=196298&r1=196297&r2=196298&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp Tue Dec  3 11:50:20 2013
@@ -86,16 +86,13 @@ Compare (BreakpointLocationSP lhs, lldb:
 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





More information about the lldb-commits mailing list