2 from lldbsuite
.test
.decorators
import *
3 from lldbsuite
.test
.lldbtest
import *
4 from lldbsuite
.test
import lldbutil
7 class TestWatchpointCount(TestBase
):
8 NO_DEBUG_INFO_TESTCASE
= True
11 oslist
=["freebsd", "linux"],
12 archs
=["arm", "aarch64"],
13 bugnumber
="llvm.org/pr26031",
15 def test_watchpoint_count(self
):
17 (_
, process
, thread
, _
) = lldbutil
.run_to_source_breakpoint(
18 self
, "patatino", lldb
.SBFileSpec("main.c")
20 frame
= thread
.GetFrameAtIndex(0)
21 first_var
= frame
.FindVariable("x1")
22 second_var
= frame
.FindVariable("x2")
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()))
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()))
34 stop_reason
= thread
.GetStopReason()
35 self
.assertStopReason(
36 stop_reason
, lldb
.eStopReasonWatchpoint
, "watchpoint for x1 not hit"
38 stop_reason_descr
= thread
.GetStopDescription(256)
39 self
.assertEqual(stop_reason_descr
, "watchpoint 1")
42 stop_reason
= thread
.GetStopReason()
43 self
.assertStopReason(
44 stop_reason
, lldb
.eStopReasonWatchpoint
, "watchpoint for x2 not hit"
46 stop_reason_descr
= thread
.GetStopDescription(256)
47 self
.assertEqual(stop_reason_descr
, "watchpoint 2")