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.GetSelectedTarget().GetProcess().Kill() 22 23 def test_gdb_remote_async(self): 24 """Test the gdb-remote command in asynchronous mode""" 25 try: 26 self.dbg.SetAsync(True) 27 self.expect("gdb-remote " + self.server.get_connect_address(), 28 matching=False, 29 substrs=['Process', 'stopped']) 30 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 31 self.process(), [lldb.eStateStopped]) 32 finally: 33 self.dbg.GetSelectedTarget().GetProcess().Kill() 34 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 35 self.process(), [lldb.eStateExited]) 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("platform select remote-gdb-server", 43 substrs=['Platform: remote-gdb-server', 'Connected: no']) 44 self.expect("process connect " + self.server.get_connect_url(), 45 substrs=['Process', 'stopped']) 46 finally: 47 self.dbg.GetSelectedTarget().GetProcess().Kill() 48 49 @skipIfWindows 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("platform select remote-gdb-server", 55 substrs=['Platform: remote-gdb-server', 'Connected: no']) 56 self.expect("process connect " + self.server.get_connect_url(), 57 matching=False, 58 substrs=['Process', 'stopped']) 59 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 60 self.process(), [lldb.eStateStopped]) 61 finally: 62 self.dbg.GetSelectedTarget().GetProcess().Kill() 63 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 64 self.process(), [lldb.eStateExited]) 65