1import gdbremote_testcase
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase):
7
8    mydir = TestBase.compute_mydir(__file__)
9
10    def vCont_supports_mode(self, mode, inferior_args=None):
11        # Setup the stub and set the gdb remote command stream.
12        procs = self.prep_debug_monitor_and_inferior(
13            inferior_args=inferior_args)
14        self.add_vCont_query_packets()
15
16        # Run the gdb remote command stream.
17        context = self.expect_gdbremote_sequence()
18        self.assertIsNotNone(context)
19
20        # Pull out supported modes.
21        supported_vCont_modes = self.parse_vCont_query_response(context)
22        self.assertIsNotNone(supported_vCont_modes)
23
24        # Verify we support the given mode.
25        self.assertIn(mode, supported_vCont_modes)
26
27
28    def test_vCont_supports_c(self):
29        self.build()
30        self.vCont_supports_mode("c")
31
32    def test_vCont_supports_C(self):
33        self.build()
34        self.vCont_supports_mode("C")
35
36    def test_vCont_supports_s(self):
37        self.build()
38        self.vCont_supports_mode("s")
39
40    def test_vCont_supports_S(self):
41        self.build()
42        self.vCont_supports_mode("S")
43
44    @skipIfWindows # No pty support to test O* & I* notification packets.
45    @skipIf(triple='^mips')
46    def test_single_step_only_steps_one_instruction_with_Hc_vCont_s(self):
47        self.build()
48        self.set_inferior_startup_launch()
49        self.single_step_only_steps_one_instruction(
50            use_Hc_packet=True, step_instruction="vCont;s")
51
52    @skipIfWindows # No pty support to test O* & I* notification packets.
53    @skipIf(triple='^mips')
54    def test_single_step_only_steps_one_instruction_with_vCont_s_thread(self):
55        self.build()
56        self.set_inferior_startup_launch()
57        self.single_step_only_steps_one_instruction(
58            use_Hc_packet=False, step_instruction="vCont;s:{thread}")
59