[Lldb-commits] [lldb] r124729 - in /lldb/trunk: source/Breakpoint/BreakpointIDList.cpp test/breakpoint_ids/TestBreakpointIDs.py

Caroline Tice ctice at apple.com
Wed Feb 2 09:48:16 PST 2011


Author: ctice
Date: Wed Feb  2 11:48:16 2011
New Revision: 124729

URL: http://llvm.org/viewvc/llvm-project?rev=124729&view=rev
Log:
Fix breakpoint id test to work with clang as well as gcc; added a few
more test cases

Fixed minor bug in the breakpoint id range translation code.


Modified:
    lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
    lldb/trunk/test/breakpoint_ids/TestBreakpointIDs.py

Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=124729&r1=124728&r2=124729&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Wed Feb  2 11:48:16 2011
@@ -258,6 +258,19 @@
                 result.SetStatus (eReturnStatusFailed);
                 return;
             }
+            
+
+            if (((start_loc_id == LLDB_INVALID_BREAK_ID)
+                 && (end_loc_id != LLDB_INVALID_BREAK_ID))
+                || ((start_loc_id != LLDB_INVALID_BREAK_ID)
+                    && (end_loc_id == LLDB_INVALID_BREAK_ID)))
+            {
+                new_args.Clear ();
+                result.AppendErrorWithFormat ("Invalid breakpoint id range:  Either both ends of range must specify"
+                                              " a breakpoint location, or neither can specify a breakpoint location.\n");
+                result.SetStatus (eReturnStatusFailed);
+                return;
+            }
 
             // We have valid range starting & ending breakpoint IDs.  Go through all the breakpoints in the
             // target and find all the breakpoints that fit into this range, and add them to new_args.
@@ -298,7 +311,7 @@
                     for (size_t k = 0; k < num_locations; ++k)
                     {
                         BreakpointLocation * bp_loc = breakpoint->GetLocationAtIndex(k).get();
-                        if (bp_loc->GetID() >= start_loc_id)
+                        if ((bp_loc->GetID() >= start_loc_id) && (bp_loc->GetID() <= end_loc_id))
                         {
                             StreamString canonical_id_str;
                             BreakpointID::GetCanonicalReference (&canonical_id_str, cur_bp_id, bp_loc->GetID());

Modified: lldb/trunk/test/breakpoint_ids/TestBreakpointIDs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_ids/TestBreakpointIDs.py?rev=124729&r1=124728&r2=124729&view=diff
==============================================================================
--- lldb/trunk/test/breakpoint_ids/TestBreakpointIDs.py (original)
+++ lldb/trunk/test/breakpoint_ids/TestBreakpointIDs.py Wed Feb  2 11:48:16 2011
@@ -26,24 +26,32 @@
                     patterns = [ "Current executable set to .*a.out" ])
 
         self.expect ("breakpoint set -n product",
-                     startstr = "Breakpoint created: 1: name = 'product', locations = 2")
+                     startstr = "Breakpoint created: 1: name = 'product', locations =")
 
         self.expect ("breakpoint set -n sum",
-                     startstr = "Breakpoint created: 2: name = 'sum', locations = 3")
+                     startstr = "Breakpoint created: 2: name = 'sum', locations =")
 
         self.expect ("breakpoint set -n junk",
                      startstr = "Breakpoint created: 3: name = 'junk', locations = 0 (pending)",
                      substrs = [ "WARNING:  Unable to resolve breakpoint to any actual locations." ] )
 
-        self.expect ("breakpoint disable 1.2 - 2.2 ",
+        self.expect ("breakpoint disable 1.1 - 2.2 ",
                      COMMAND_FAILED_AS_EXPECTED, error = True,
                      startstr = "error: Invalid range: Ranges that specify particular breakpoint locations must be within the same major breakpoint; you specified two different major breakpoints, 1 and 2.")
 
-        self.expect ("breakpoint disable 1.1 - 1.2",
+        self.expect ("breakpoint disable 2 - 2.2",
+                     COMMAND_FAILED_AS_EXPECTED, error = True,
+                     startstr = "error: Invalid breakpoint id range:  Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.")
+
+        self.expect ("breakpoint disable 2.1 - 2",
+                     COMMAND_FAILED_AS_EXPECTED, error = True,
+                     startstr = "error: Invalid breakpoint id range:  Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.")
+
+        self.expect ("breakpoint disable 2.1 - 2.2",
                      startstr = "2 breakpoints disabled.")
 
-        self.expect ("breakpoint enable 1.*",
-                     startstr = "2 breakpoints enabled.")
+        self.expect ("breakpoint enable 2.*",
+                     patterns = [ ".* breakpoints enabled."] )
 
 if __name__ == '__main__':
     import atexit





More information about the lldb-commits mailing list