1import lldb 2from lldbsuite.test.decorators import * 3from lldbsuite.test.lldbtest import * 4from lldbsuite.test import lldbutil 5 6class TestWatchpointCount(TestBase): 7 NO_DEBUG_INFO_TESTCASE = True 8 9 def setUp(self): 10 TestBase.setUp(self) 11 12 @skipIf(oslist=["freebsd", "linux"], archs=["arm", "aarch64"], 13 bugnumber="llvm.org/pr26031") 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