1import lldb 2import binascii 3import os 4from lldbsuite.test.lldbtest import * 5from lldbsuite.test.decorators import * 6from lldbsuite.test.gdbclientutils import * 7from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase 8 9 10@skipIfRemote 11class TestProcessConnect(GDBRemoteTestBase): 12 13 mydir = TestBase.compute_mydir(__file__) 14 15 NO_DEBUG_INFO_TESTCASE = True 16 17 def test_gdb_remote_sync(self): 18 """Test the gdb-remote command in synchronous mode""" 19 try: 20 self.dbg.SetAsync(False) 21 self.expect("gdb-remote " + self.server.get_connect_address(), 22 substrs=['Process', 'stopped']) 23 finally: 24 self.dbg.GetSelectedTarget().GetProcess().Kill() 25 26 def test_gdb_remote_async(self): 27 """Test the gdb-remote command in asynchronous mode""" 28 try: 29 self.dbg.SetAsync(True) 30 self.expect("gdb-remote " + self.server.get_connect_address(), 31 matching=False, 32 substrs=['Process', 'stopped']) 33 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 34 self.process(), [lldb.eStateStopped]) 35 finally: 36 self.dbg.GetSelectedTarget().GetProcess().Kill() 37 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 38 self.process(), [lldb.eStateExited]) 39 40 @skipIfWindows 41 def test_process_connect_sync(self): 42 """Test the gdb-remote command in synchronous mode""" 43 try: 44 self.dbg.SetAsync(False) 45 self.expect("platform select remote-gdb-server", 46 substrs=['Platform: remote-gdb-server', 'Connected: no']) 47 self.expect("process connect " + self.server.get_connect_url(), 48 substrs=['Process', 'stopped']) 49 finally: 50 self.dbg.GetSelectedTarget().GetProcess().Kill() 51 52 @skipIfWindows 53 def test_process_connect_async(self): 54 """Test the gdb-remote command in asynchronous mode""" 55 try: 56 self.dbg.SetAsync(True) 57 self.expect("platform select remote-gdb-server", 58 substrs=['Platform: remote-gdb-server', 'Connected: no']) 59 self.expect("process connect " + self.server.get_connect_url(), 60 matching=False, 61 substrs=['Process', 'stopped']) 62 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 63 self.process(), [lldb.eStateStopped]) 64 finally: 65 self.dbg.GetSelectedTarget().GetProcess().Kill() 66 lldbutil.expect_state_changes(self, self.dbg.GetListener(), 67 self.process(), [lldb.eStateExited]) 68