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    @add_test_categories(["llgs"])
43    def test_vCont_supports_t(self):
44        self.build()
45        self.vCont_supports_mode("t")
46
47    @skipIfWindows # No pty support to test O* & I* notification packets.
48    @skipIf(triple='^mips')
49    def test_single_step_only_steps_one_instruction_with_Hc_vCont_s(self):
50        self.build()
51        self.set_inferior_startup_launch()
52        self.single_step_only_steps_one_instruction(
53            use_Hc_packet=True, step_instruction="vCont;s")
54
55    @skipIfWindows # No pty support to test O* & I* notification packets.
56    @skipIf(triple='^mips')
57    def test_single_step_only_steps_one_instruction_with_vCont_s_thread(self):
58        self.build()
59        self.set_inferior_startup_launch()
60        self.single_step_only_steps_one_instruction(
61            use_Hc_packet=False, step_instruction="vCont;s:{thread}")
62