1import lldb 2from lldbsuite.test.decorators import * 3from lldbsuite.test.lldbtest import * 4from lldbsuite.test import lldbutil 5 6class TestWatchpointCount(TestBase): 7 mydir = TestBase.compute_mydir(__file__) 8 NO_DEBUG_INFO_TESTCASE = True 9 10 def setUp(self): 11 TestBase.setUp(self) 12 13 @skipIf(oslist=["linux"], archs=["aarch64"]) 14 def test_watchpoint_count(self): 15 self.build() 16 (_, process, thread, _) = lldbutil.run_to_source_breakpoint(self, "patatino", lldb.SBFileSpec("main.c")) 17 frame = thread.GetFrameAtIndex(0) 18 first_var = frame.FindVariable("x1") 19 second_var = frame.FindVariable("x2") 20 21 error = lldb.SBError() 22 first_watch = first_var.Watch(True, False, True, error) 23 if not error.Success(): 24 self.fail( 25 "Failed to make watchpoint for x1: %s" % 26 (error.GetCString())) 27 28 second_watch = second_var.Watch(True, False, True, error) 29 if not error.Success(): 30 self.fail( 31 "Failed to make watchpoint for x2: %s" % 32 (error.GetCString())) 33 process.Continue() 34 35 stop_reason = thread.GetStopReason() 36 self.assertEqual(stop_reason, lldb.eStopReasonWatchpoint, "watchpoint for x1 not hit") 37 stop_reason_descr = thread.GetStopDescription(256) 38 self.assertEqual(stop_reason_descr, "watchpoint 1") 39 40 process.Continue() 41 stop_reason = thread.GetStopReason() 42 self.assertEqual(stop_reason, lldb.eStopReasonWatchpoint, "watchpoint for x2 not hit") 43 stop_reason_descr = thread.GetStopDescription(256) 44 self.assertEqual(stop_reason_descr, "watchpoint 2") 45