xref: /llvm-project/lldb/test/API/functionalities/gdb_remote_client/TestContinue.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
12f50883cSMichał Górnyimport lldb
22f50883cSMichał Górnyfrom lldbsuite.test.lldbtest import *
32f50883cSMichał Górnyfrom lldbsuite.test.decorators import *
42f50883cSMichał Górnyfrom lldbsuite.test.gdbclientutils import *
52f50883cSMichał Górnyfrom lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
62f50883cSMichał Górny
72f50883cSMichał Górny
82f50883cSMichał Górnyclass TestContinue(GDBRemoteTestBase):
92f50883cSMichał Górny    class BaseResponder(MockGDBServerResponder):
102f50883cSMichał Górny        def qSupported(self, client_supported):
112f50883cSMichał Górny            return "PacketSize=3fff;QStartNoAckMode+;multiprocess+"
122f50883cSMichał Górny
132f50883cSMichał Górny        def qfThreadInfo(self):
142f50883cSMichał Górny            return "mp400.401"
152f50883cSMichał Górny
162f50883cSMichał Górny        def haltReason(self):
172f50883cSMichał Górny            return "S13"
182f50883cSMichał Górny
192f50883cSMichał Górny        def cont(self):
202f50883cSMichał Górny            return "W01"
212f50883cSMichał Górny
222f50883cSMichał Górny        def other(self, packet):
232f50883cSMichał Górny            if packet == "vCont?":
242f50883cSMichał Górny                return "vCont;c;C;s;S"
252f50883cSMichał Górny            if packet.startswith("vCont;"):
262f50883cSMichał Górny                return "W00"
272f50883cSMichał Górny            return ""
282f50883cSMichał Górny
292f50883cSMichał Górny    def test_continue_no_multiprocess(self):
302f50883cSMichał Górny        class MyResponder(self.BaseResponder):
312f50883cSMichał Górny            def qSupported(self, client_supported):
322f50883cSMichał Górny                return "PacketSize=3fff;QStartNoAckMode+"
332f50883cSMichał Górny
342f50883cSMichał Górny            def qfThreadInfo(self):
352f50883cSMichał Górny                return "m401"
362f50883cSMichał Górny
372f50883cSMichał Górny        self.server.responder = MyResponder()
382f50883cSMichał Górny        self.runCmd("platform select remote-linux")
392f50883cSMichał Górny        target = self.createTarget("a.yaml")
402f50883cSMichał Górny        process = self.connect(target)
41*2238dcc3SJonas Devlieghere        lldbutil.expect_state_changes(
42*2238dcc3SJonas Devlieghere            self, self.dbg.GetListener(), process, [lldb.eStateExited]
43*2238dcc3SJonas Devlieghere        )
442f50883cSMichał Górny        self.assertPacketLogContains(["vCont;C13:401"])
452f50883cSMichał Górny
462f50883cSMichał Górny    def test_continue_no_vCont(self):
472f50883cSMichał Górny        class MyResponder(self.BaseResponder):
482f50883cSMichał Górny            def qSupported(self, client_supported):
492f50883cSMichał Górny                return "PacketSize=3fff;QStartNoAckMode+"
502f50883cSMichał Górny
512f50883cSMichał Górny            def qfThreadInfo(self):
522f50883cSMichał Górny                return "m401"
532f50883cSMichał Górny
542f50883cSMichał Górny            def other(self, packet):
552f50883cSMichał Górny                return ""
562f50883cSMichał Górny
572f50883cSMichał Górny        self.server.responder = MyResponder()
582f50883cSMichał Górny        self.runCmd("platform select remote-linux")
592f50883cSMichał Górny        target = self.createTarget("a.yaml")
602f50883cSMichał Górny        process = self.connect(target)
61*2238dcc3SJonas Devlieghere        lldbutil.expect_state_changes(
62*2238dcc3SJonas Devlieghere            self, self.dbg.GetListener(), process, [lldb.eStateExited]
63*2238dcc3SJonas Devlieghere        )
642f50883cSMichał Górny        self.assertPacketLogContains(["Hc401", "C13"])
652f50883cSMichał Górny
662f50883cSMichał Górny    def test_continue_multiprocess(self):
672f50883cSMichał Górny        class MyResponder(self.BaseResponder):
682f50883cSMichał Górny            pass
692f50883cSMichał Górny
702f50883cSMichał Górny        self.server.responder = MyResponder()
712f50883cSMichał Górny        self.runCmd("platform select remote-linux")
722f50883cSMichał Górny        target = self.createTarget("a.yaml")
732f50883cSMichał Górny        process = self.connect(target)
74*2238dcc3SJonas Devlieghere        lldbutil.expect_state_changes(
75*2238dcc3SJonas Devlieghere            self, self.dbg.GetListener(), process, [lldb.eStateExited]
76*2238dcc3SJonas Devlieghere        )
772f50883cSMichał Górny        self.assertPacketLogContains(["vCont;C13:p400.401"])
78