1import lldb 2import binascii 3import os 4from lldbsuite.test.lldbtest import * 5from lldbsuite.test.decorators import * 6from gdbclientutils import * 7 8 9class TestProcessConnect(GDBRemoteTestBase): 10 11 NO_DEBUG_INFO_TESTCASE = True 12 13 @skipIfWindows 14 def test_gdb_remote_sync(self): 15 """Test the gdb-remote command in synchronous mode""" 16 try: 17 self.dbg.SetAsync(False) 18 self.expect("gdb-remote %d" % self.server.port, 19 substrs=['Process', 'stopped']) 20 finally: 21 self.dbg.GetSelectedPlatform().DisconnectRemote() 22 23 @skipIfWindows 24 @skipIfReproducer # Reproducer don't support async. 25 def test_gdb_remote_async(self): 26 """Test the gdb-remote command in asynchronous mode""" 27 try: 28 self.dbg.SetAsync(True) 29 self.expect("gdb-remote %d" % self.server.port, 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.GetSelectedPlatform().DisconnectRemote() 36 37 @skipIfWindows 38 def test_process_connect_sync(self): 39 """Test the gdb-remote command in synchronous mode""" 40 try: 41 self.dbg.SetAsync(False) 42 self.expect("process connect connect://localhost:%d" % 43 self.server.port, 44 substrs=['Process', 'stopped']) 45 finally: 46 self.dbg.GetSelectedPlatform().DisconnectRemote() 47 48 @skipIfWindows 49 @skipIfReproducer # Reproducer don't support async. 50 def test_process_connect_async(self): 51 """Test the gdb-remote command in asynchronous mode""" 52 try: 53 self.dbg.SetAsync(True) 54 self.expect("process connect connect://localhost:%d" % 55 self.server.port, 56 matching=False, 57 substrs=['Process', 'stopped']) 58 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 59 self.process(), [lldb.eStateStopped]) 60 finally: 61 self.dbg.GetSelectedPlatform().DisconnectRemote() 62