1import lldb 2from lldbsuite.test.lldbtest import * 3from lldbsuite.test.decorators import * 4from gdbclientutils import * 5 6 7@skipIfWindows 8class TestPty(GDBRemoteTestBase): 9 mydir = TestBase.compute_mydir(__file__) 10 server_socket_class = PtyServerSocket 11 12 def test_process_connect_sync(self): 13 """Test the process connect command in synchronous mode""" 14 try: 15 self.dbg.SetAsync(False) 16 self.expect("platform select remote-gdb-server", 17 substrs=['Platform: remote-gdb-server', 'Connected: no']) 18 self.expect("process connect " + self.server.get_connect_url(), 19 substrs=['Process', 'stopped']) 20 finally: 21 self.dbg.GetSelectedTarget().GetProcess().Kill() 22 23 def test_process_connect_async(self): 24 """Test the process connect command in asynchronous mode""" 25 try: 26 self.dbg.SetAsync(True) 27 self.expect("platform select remote-gdb-server", 28 substrs=['Platform: remote-gdb-server', 'Connected: no']) 29 self.expect("process connect " + self.server.get_connect_url(), 30 matching=False, 31 substrs=['Process', 'stopped']) 32 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 33 self.process(), [lldb.eStateStopped]) 34 finally: 35 self.dbg.GetSelectedTarget().GetProcess().Kill() 36 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 37 self.process(), [lldb.eStateExited]) 38