1""" 2Watch one byte in the middle of a doubleword, mutate the 3entire doubleword including the watched byte. On AArch64 4the trap address is probably the start of the doubleword, 5instead of the address of our watched byte. Test that lldb 6correctly associates this watchpoint trap with our watchpoint. 7""" 8 9 10import lldb 11from lldbsuite.test.decorators import * 12from lldbsuite.test.lldbtest import * 13from lldbsuite.test import lldbutil 14 15 16class UnalignedWatchpointTestCase(TestBase): 17 NO_DEBUG_INFO_TESTCASE = True 18 19 @skipIfOutOfTreeDebugserver 20 def test_unaligned_watchpoint(self): 21 """Test an unaligned watchpoint triggered by a larger aligned write.""" 22 self.build() 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 26 ) 27 28 frame = thread.GetFrameAtIndex(0) 29 30 self.expect("watchpoint set variable a.buf[2]") 31 32 self.runCmd("process continue") 33 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. 36 self.expect( 37 "thread list", 38 STOPPED_DUE_TO_WATCHPOINT, 39 substrs=["stopped", "stop reason = watchpoint"], 40 ) 41 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"]) 45 46 self.runCmd("process continue") 47 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. 50 self.expect( 51 "thread list", 52 STOPPED_DUE_TO_WATCHPOINT, 53 substrs=["stopped", "stop reason = watchpoint"], 54 ) 55 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"]) 59