xref: /llvm-project/lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py (revision 1695c8420a1c43ff6f4ff442ce5fa0cdd2f6e78f)
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    @skipIfWindows
15    def test_gdb_remote_sync(self):
16        """Test the gdb-remote command in synchronous mode"""
17        try:
18            self.dbg.SetAsync(False)
19            self.expect("gdb-remote " + self.server.get_connect_address(),
20                        substrs=['Process', 'stopped'])
21        finally:
22            self.dbg.GetSelectedPlatform().DisconnectRemote()
23
24    @skipIfWindows
25    @skipIfReproducer # Reproducer don't support async.
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.GetSelectedPlatform().DisconnectRemote()
37
38    @skipIfWindows
39    def test_process_connect_sync(self):
40        """Test the gdb-remote command in synchronous mode"""
41        try:
42            self.dbg.SetAsync(False)
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("process connect connect://" +
56                        self.server.get_connect_address(),
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.GetSelectedPlatform().DisconnectRemote()
63