[Lldb-commits] [lldb] r115092 - /lldb/trunk/source/Breakpoint/BreakpointIDList.cpp

Johnny Chen johnny.chen at apple.com
Wed Sep 29 14:57:51 PDT 2010


Author: johnny
Date: Wed Sep 29 16:57:51 2010
New Revision: 115092

URL: http://llvm.org/viewvc/llvm-project?rev=115092&view=rev
Log:
Verify that we have a valid breakpoint ID before proceeding with retrieving its
number of locations.  This fixed a crasher.

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

Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=115092&r1=115091&r2=115092&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Wed Sep 29 16:57:51 2010
@@ -212,6 +212,13 @@
 
                     BreakpointID::ParseCanonicalReference (bp_id_str.c_str(), &bp_id, &bp_loc_id);
                     BreakpointSP breakpoint_sp = target->GetBreakpointByID (bp_id);
+                    if (! breakpoint_sp)
+                    {
+                        new_args.Clear();
+                        result.AppendErrorWithFormat ("'%d' is not a valid breakpoint ID.\n", bp_id);
+                        result.SetStatus (eReturnStatusFailed);
+                        return;
+                    }
                     const size_t num_locations = breakpoint_sp->GetNumLocations();
                     for (size_t j = 0; j < num_locations; ++j)
                     {





More information about the lldb-commits mailing list