[Lldb-commits] [lldb] r276914 - Fixed "void SBWatchpoint::SetEnabled (bool enabled)" to work properly and added a test for it.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 27 13:47:49 PDT 2016


Author: gclayton
Date: Wed Jul 27 15:47:49 2016
New Revision: 276914

URL: http://llvm.org/viewvc/llvm-project?rev=276914&view=rev
Log:
Fixed "void SBWatchpoint::SetEnabled (bool enabled)" to work properly and added a test for it.

https://llvm.org/bugs/show_bug.cgi?id=28729
<rdar://problem/27575225>


Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
    lldb/trunk/source/API/SBWatchpoint.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py?rev=276914&r1=276913&r2=276914&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py Wed Jul 27 15:47:49 2016
@@ -64,17 +64,23 @@ class TestWatchpointEvents (TestBase):
         if not error.Success():
             self.fail ("Failed to make watchpoint for local_var: %s"%(error.GetCString()))
 
-        self.GetWatchpointEvent (lldb.eWatchpointEventTypeAdded)
+        self.GetWatchpointEvent(lldb.eWatchpointEventTypeAdded)
         # Now change some of the features of this watchpoint and make sure we get events:
         local_watch.SetEnabled(False)
-        self.GetWatchpointEvent (lldb.eWatchpointEventTypeDisabled)
+        self.GetWatchpointEvent(lldb.eWatchpointEventTypeDisabled)
+
+        local_watch.SetEnabled(True)
+        self.GetWatchpointEvent(lldb.eWatchpointEventTypeEnabled)
 
         local_watch.SetIgnoreCount(10)
-        self.GetWatchpointEvent (lldb.eWatchpointEventTypeIgnoreChanged)
+        self.GetWatchpointEvent(lldb.eWatchpointEventTypeIgnoreChanged)
 
-        local_watch.SetCondition ("1 == 2")
-        self.GetWatchpointEvent (lldb.eWatchpointEventTypeConditionChanged)
+        condition = "1 == 2"
+        local_watch.SetCondition(condition)
+        self.GetWatchpointEvent(lldb.eWatchpointEventTypeConditionChanged)
 
+        self.assertTrue(local_watch.GetCondition() == condition, 'make sure watchpoint condition is "' + condition + '"');
+        
     def GetWatchpointEvent (self, event_type):
         # We added a watchpoint so we should get a watchpoint added event.
         event = lldb.SBEvent()

Modified: lldb/trunk/source/API/SBWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpoint.cpp?rev=276914&r1=276913&r2=276914&view=diff
==============================================================================
--- lldb/trunk/source/API/SBWatchpoint.cpp (original)
+++ lldb/trunk/source/API/SBWatchpoint.cpp Wed Jul 27 15:47:49 2016
@@ -159,7 +159,7 @@ SBWatchpoint::SetEnabled (bool enabled)
     if (watchpoint_sp)
     {
         std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
-        watchpoint_sp->GetTarget().DisableWatchpointByID(watchpoint_sp->GetID());
+        watchpoint_sp->SetEnabled(enabled);
     }
 }
 




More information about the lldb-commits mailing list