2 Watch one byte in the middle of a doubleword, mutate the
3 entire doubleword including the watched byte. On AArch64
4 the trap address is probably the start of the doubleword,
5 instead of the address of our watched byte. Test that lldb
6 correctly associates this watchpoint trap with our watchpoint.
11 from lldbsuite
.test
.decorators
import *
12 from lldbsuite
.test
.lldbtest
import *
13 from lldbsuite
.test
import lldbutil
16 class UnalignedWatchpointTestCase(TestBase
):
17 NO_DEBUG_INFO_TESTCASE
= True
19 @skipIfOutOfTreeDebugserver
20 def test_unaligned_watchpoint(self
):
21 """Test an unaligned watchpoint triggered by a larger aligned write."""
23 self
.main_source_file
= lldb
.SBFileSpec("main.c")
24 (target
, process
, thread
, bkpt
) = lldbutil
.run_to_source_breakpoint(
25 self
, "break here", self
.main_source_file
28 frame
= thread
.GetFrameAtIndex(0)
30 self
.expect("watchpoint set variable a.buf[2]")
32 self
.runCmd("process continue")
34 # We should be stopped again due to the watchpoint (write type), but
35 # only once. The stop reason of the thread should be watchpoint.
38 STOPPED_DUE_TO_WATCHPOINT
,
39 substrs
=["stopped", "stop reason = watchpoint"],
42 # Use the '-v' option to do verbose listing of the watchpoint.
43 # The hit count should now be 1.
44 self
.expect("watchpoint list -v", substrs
=["hit_count = 1"])
46 self
.runCmd("process continue")
48 # We should be stopped again due to the watchpoint (write type), but
49 # only once. The stop reason of the thread should be watchpoint.
52 STOPPED_DUE_TO_WATCHPOINT
,
53 substrs
=["stopped", "stop reason = watchpoint"],
56 # Use the '-v' option to do verbose listing of the watchpoint.
57 # The hit count should now be 1.
58 self
.expect("watchpoint list -v", substrs
=["hit_count = 2"])