xref: /llvm-project/lldb/test/API/functionalities/step-vrs-interrupt/TestStepVrsInterruptTimeout.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1379f24ffSJim Ingham"""
2379f24ffSJim InghamThis is to make sure that the interrupt timer
3379f24ffSJim Inghamdoesn't influence synchronous user level stepping.
4379f24ffSJim Ingham"""
5379f24ffSJim Ingham
6379f24ffSJim Inghamimport lldb
7379f24ffSJim Inghamimport lldbsuite.test.lldbutil as lldbutil
8379f24ffSJim Inghamfrom lldbsuite.test.lldbtest import *
9379f24ffSJim Ingham
10379f24ffSJim Ingham
11379f24ffSJim Inghamclass TestStepVrsInterruptTimeout(TestBase):
12379f24ffSJim Ingham    NO_DEBUG_INFO_TESTCASE = True
13379f24ffSJim Ingham
14379f24ffSJim Ingham    def test_step_vrs_interrupt(self):
15379f24ffSJim Ingham        """This test is to make sure that the interrupt timeout
16379f24ffSJim Ingham        doesn't cause use to flub events from a synchronous step."""
17379f24ffSJim Ingham        self.build()
18379f24ffSJim Ingham        self.main_source_file = lldb.SBFileSpec("main.cpp")
19379f24ffSJim Ingham        self.sample_test()
20379f24ffSJim Ingham
21379f24ffSJim Ingham    def sample_test(self):
22379f24ffSJim Ingham        """You might use the test implementation in several ways, say so here."""
23379f24ffSJim Ingham
24379f24ffSJim Ingham        # This function starts a process, "a.out" by default, sets a source
25379f24ffSJim Ingham        # breakpoint, runs to it, and returns the thread, process & target.
26379f24ffSJim Ingham        # It optionally takes an SBLaunchOption argument if you want to pass
27379f24ffSJim Ingham        # arguments or environment variables.
28*2238dcc3SJonas Devlieghere        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
29*2238dcc3SJonas Devlieghere            self, "Set a breakpoint here", self.main_source_file
30*2238dcc3SJonas Devlieghere        )
31379f24ffSJim Ingham        self.dbg.SetAsync(False)
32379f24ffSJim Ingham        self.runCmd("settings set target.process.interrupt-timeout 1")
33379f24ffSJim Ingham        thread.StepOver()
34*2238dcc3SJonas Devlieghere        self.assertState(
35*2238dcc3SJonas Devlieghere            process.GetState(), lldb.eStateStopped, "Stopped like we should"
36*2238dcc3SJonas Devlieghere        )
37