xref: /llvm-project/lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py (revision 2c2eb5e6702bf3bbb8fb8f09790b1ab7b139e879)
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    @expectedFailureAll(oslist=["freebsd"])
40    def test_process_connect_sync(self):
41        """Test the gdb-remote command in synchronous mode"""
42        try:
43            self.dbg.SetAsync(False)
44            self.expect("process connect connect://" +
45                        self.server.get_connect_address(),
46                        substrs=['Process', 'stopped'])
47        finally:
48            self.dbg.GetSelectedPlatform().DisconnectRemote()
49
50    @skipIfWindows
51    @expectedFailureAll(oslist=["freebsd"])
52    @skipIfReproducer # Reproducer don't support async.
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("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