brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 5f9e528 Raw
58 lines · python
1"""2Watch one byte in the middle of a doubleword, mutate the3entire doubleword including the watched byte.  On AArch644the trap address is probably the start of the doubleword,5instead of the address of our watched byte.  Test that lldb6correctly associates this watchpoint trap with our watchpoint.7"""8 9 10import lldb11from lldbsuite.test.decorators import *12from lldbsuite.test.lldbtest import *13from lldbsuite.test import lldbutil14 15 16class UnalignedWatchpointTestCase(TestBase):17    NO_DEBUG_INFO_TESTCASE = True18 19    def test_unaligned_watchpoint(self):20        """Test an unaligned watchpoint triggered by a larger aligned write."""21        self.build()22        self.main_source_file = lldb.SBFileSpec("main.c")23        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(24            self, "break here", self.main_source_file25        )26 27        frame = thread.GetFrameAtIndex(0)28 29        self.expect("watchpoint set variable a.buf[2]")30 31        self.runCmd("process continue")32 33        # We should be stopped again due to the watchpoint (write type), but34        # only once.  The stop reason of the thread should be watchpoint.35        self.expect(36            "thread list",37            STOPPED_DUE_TO_WATCHPOINT,38            substrs=["stopped", "stop reason = watchpoint"],39        )40 41        # Use the '-v' option to do verbose listing of the watchpoint.42        # The hit count should now be 1.43        self.expect("watchpoint list -v", substrs=["hit_count = 1"])44 45        self.runCmd("process continue")46 47        # We should be stopped again due to the watchpoint (write type), but48        # only once.  The stop reason of the thread should be watchpoint.49        self.expect(50            "thread list",51            STOPPED_DUE_TO_WATCHPOINT,52            substrs=["stopped", "stop reason = watchpoint"],53        )54 55        # Use the '-v' option to do verbose listing of the watchpoint.56        # The hit count should now be 1.57        self.expect("watchpoint list -v", substrs=["hit_count = 2"])58