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