2 Test watchpoint slots we should not be able to install multiple watchpoints
3 within same word boundary. We should be able to install individual watchpoints
4 on any of the bytes, half-word, or word. This is only for ARM/AArch64 targets.
9 from lldbsuite
.test
.decorators
import *
10 from lldbsuite
.test
.lldbtest
import *
11 from lldbsuite
.test
import lldbutil
14 class WatchpointSlotsTestCase(TestBase
):
15 NO_DEBUG_INFO_TESTCASE
= True
18 # Call super's setUp().
22 self
.source
= "main.c"
25 self
.exe_name
= self
.getBuildArtifact("a.out")
26 self
.d
= {"C_SOURCES": self
.source
, "EXE": self
.exe_name
}
28 # This is a arm and aarch64 specific test case. No other architectures tested.
29 @skipIf(archs
=no_match(["arm", "aarch64"]))
30 def test_multiple_watchpoints_on_same_word(self
):
31 self
.build(dictionary
=self
.d
)
32 self
.setTearDownCleanup(dictionary
=self
.d
)
34 exe
= self
.getBuildArtifact(self
.exe_name
)
35 self
.runCmd("file " + exe
, CURRENT_EXECUTABLE_SET
)
37 # Detect line number after which we are going to increment arrayName.
38 loc_line
= line_number("main.c", "// About to write byteArray")
40 # Set a breakpoint on the line detected above.
41 lldbutil
.run_break_set_by_file_and_line(
42 self
, "main.c", loc_line
, num_expected_locations
=1, loc_exact
=True
46 self
.runCmd("run", RUN_SUCCEEDED
)
48 # The stop reason of the thread should be breakpoint.
51 STOPPED_DUE_TO_BREAKPOINT
,
52 substrs
=["stopped", "stop reason = breakpoint"],
55 # Delete breakpoint we just hit.
56 self
.expect("breakpoint delete 1", substrs
=["1 breakpoints deleted"])
58 # Set a watchpoint at byteArray[0]
60 "watchpoint set variable byteArray[0]",
62 substrs
=["Watchpoint created", "size = 1"],
65 # Use the '-v' option to do verbose listing of the watchpoint.
66 # The hit count should be 0 initially.
67 self
.expect("watchpoint list -v 1", substrs
=["hit_count = 0"])
69 # debugserver on ios doesn't give an error, it creates another watchpoint,
70 # only expect errors on non-darwin platforms.
71 if not self
.platformIsDarwin():
72 # Try setting a watchpoint at byteArray[1]
74 "watchpoint set variable byteArray[1]",
76 substrs
=["Watchpoint creation failed"],
79 self
.runCmd("process continue")
81 # We should be stopped due to the watchpoint.
82 # The stop reason of the thread should be watchpoint.
85 STOPPED_DUE_TO_WATCHPOINT
,
86 substrs
=["stopped", "stop reason = watchpoint 1"],
89 # Delete the watchpoint we hit above successfully.
90 self
.expect("watchpoint delete 1", substrs
=["1 watchpoints deleted"])
92 # Set a watchpoint at byteArray[3]
94 "watchpoint set variable byteArray[3]",
96 substrs
=["Watchpoint created", "size = 1"],
100 self
.runCmd("process continue")
102 # We should be stopped due to the watchpoint.
103 # The stop reason of the thread should be watchpoint.
104 if self
.platformIsDarwin():
105 # On darwin we'll hit byteArray[3] which is watchpoint 2
108 STOPPED_DUE_TO_WATCHPOINT
,
109 substrs
=["stopped", "stop reason = watchpoint 2"],
114 STOPPED_DUE_TO_WATCHPOINT
,
115 substrs
=["stopped", "stop reason = watchpoint 3"],
119 self
.runCmd("process continue")