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