brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · f9c3f33 Raw
51 lines · python
1"""2Test handling of cases when a single instruction triggers multiple watchpoints3"""4 5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10 11 12class MultipleHitsTestCase(TestBase):13    NO_DEBUG_INFO_TESTCASE = True14 15    @skipIf(16        bugnumber="llvm.org/pr30758",17        oslist=["linux"],18        archs=["arm$", "aarch64", "powerpc64le"],19    )20    @skipIfwatchOS21    def test(self):22        self.build()23        target = self.createTestTarget()24 25        bp = target.BreakpointCreateByName("main")26        self.assertTrue(bp and bp.IsValid(), "Breakpoint is valid")27 28        process = target.LaunchSimple(None, None, self.get_process_working_directory())29        self.assertState(process.GetState(), lldb.eStateStopped)30 31        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)32        self.assertIsNotNone(thread)33 34        frame = thread.GetFrameAtIndex(0)35        self.assertTrue(frame and frame.IsValid(), "Frame is valid")36 37        buf = frame.FindValue("buf", lldb.eValueTypeVariableGlobal)38        self.assertTrue(buf and buf.IsValid(), "buf is valid")39 40        for i in [0, target.GetAddressByteSize()]:41            member = buf.GetChildAtIndex(i)42            self.assertTrue(member and member.IsValid(), "member is valid")43 44            error = lldb.SBError()45            watch = member.Watch(True, True, True, error)46            self.assertSuccess(error)47 48        process.Continue()49        self.assertState(process.GetState(), lldb.eStateStopped)50        self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonWatchpoint)51