1706cccb8SJonas Devlieghereimport lldb 2706cccb8SJonas Devlieghereimport binascii 3706cccb8SJonas Devlieghereimport os 4706cccb8SJonas Devliegherefrom lldbsuite.test.lldbtest import * 5706cccb8SJonas Devliegherefrom lldbsuite.test.decorators import * 6*33c0f93fSPavel Labathfrom lldbsuite.test.gdbclientutils import * 7*33c0f93fSPavel Labathfrom lldbsuite.test.lldbgdbclient import GDBRemoteTestBase 8706cccb8SJonas Devlieghere 9706cccb8SJonas Devlieghere 1031137b87SJonas Devlieghere@skipIfRemote 11706cccb8SJonas Devlieghereclass TestProcessConnect(GDBRemoteTestBase): 12f5f15aceSJonas Devlieghere 13f5f15aceSJonas Devlieghere NO_DEBUG_INFO_TESTCASE = True 14f5f15aceSJonas Devlieghere 15706cccb8SJonas Devlieghere def test_gdb_remote_sync(self): 16706cccb8SJonas Devlieghere """Test the gdb-remote command in synchronous mode""" 17706cccb8SJonas Devlieghere try: 18706cccb8SJonas Devlieghere self.dbg.SetAsync(False) 191695c842SPavel Labath self.expect("gdb-remote " + self.server.get_connect_address(), 20706cccb8SJonas Devlieghere substrs=['Process', 'stopped']) 21706cccb8SJonas Devlieghere finally: 2245f97950SMichał Górny self.dbg.GetSelectedTarget().GetProcess().Kill() 23706cccb8SJonas Devlieghere 24706cccb8SJonas Devlieghere def test_gdb_remote_async(self): 25706cccb8SJonas Devlieghere """Test the gdb-remote command in asynchronous mode""" 26706cccb8SJonas Devlieghere try: 27706cccb8SJonas Devlieghere self.dbg.SetAsync(True) 281695c842SPavel Labath self.expect("gdb-remote " + self.server.get_connect_address(), 29706cccb8SJonas Devlieghere matching=False, 30706cccb8SJonas Devlieghere substrs=['Process', 'stopped']) 31706cccb8SJonas Devlieghere lldbutil.expect_state_changes(self, self.dbg.GetListener(), 32706cccb8SJonas Devlieghere self.process(), [lldb.eStateStopped]) 33706cccb8SJonas Devlieghere finally: 3445f97950SMichał Górny self.dbg.GetSelectedTarget().GetProcess().Kill() 3545f97950SMichał Górny lldbutil.expect_state_changes(self, self.dbg.GetListener(), 3645f97950SMichał Górny self.process(), [lldb.eStateExited]) 37706cccb8SJonas Devlieghere 38a8f6f4e8SMichał Górny @skipIfWindows 39706cccb8SJonas Devlieghere def test_process_connect_sync(self): 40706cccb8SJonas Devlieghere """Test the gdb-remote command in synchronous mode""" 41706cccb8SJonas Devlieghere try: 42706cccb8SJonas Devlieghere self.dbg.SetAsync(False) 43b20f3cc5SJonas Devlieghere self.expect("platform select remote-gdb-server", 44b20f3cc5SJonas Devlieghere substrs=['Platform: remote-gdb-server', 'Connected: no']) 458fa2394bSMichał Górny self.expect("process connect " + self.server.get_connect_url(), 46706cccb8SJonas Devlieghere substrs=['Process', 'stopped']) 47706cccb8SJonas Devlieghere finally: 4845f97950SMichał Górny self.dbg.GetSelectedTarget().GetProcess().Kill() 49706cccb8SJonas Devlieghere 50a8f6f4e8SMichał Górny @skipIfWindows 51706cccb8SJonas Devlieghere def test_process_connect_async(self): 52706cccb8SJonas Devlieghere """Test the gdb-remote command in asynchronous mode""" 53706cccb8SJonas Devlieghere try: 54706cccb8SJonas Devlieghere self.dbg.SetAsync(True) 55b20f3cc5SJonas Devlieghere self.expect("platform select remote-gdb-server", 56b20f3cc5SJonas Devlieghere substrs=['Platform: remote-gdb-server', 'Connected: no']) 578fa2394bSMichał Górny self.expect("process connect " + self.server.get_connect_url(), 58706cccb8SJonas Devlieghere matching=False, 59706cccb8SJonas Devlieghere substrs=['Process', 'stopped']) 60706cccb8SJonas Devlieghere lldbutil.expect_state_changes(self, self.dbg.GetListener(), 61706cccb8SJonas Devlieghere self.process(), [lldb.eStateStopped]) 62706cccb8SJonas Devlieghere finally: 6345f97950SMichał Górny self.dbg.GetSelectedTarget().GetProcess().Kill() 6445f97950SMichał Górny lldbutil.expect_state_changes(self, self.dbg.GetListener(), 6545f97950SMichał Górny self.process(), [lldb.eStateExited]) 66