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