xref: /llvm-project/lldb/test/API/lang/c/stepping/TestThreadStepInAvoidRegexp.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1b7c06dcbSVedant Kumar"""
2b7c06dcbSVedant KumarTest thread step-in [ -r | --step-over-regexp ].
3b7c06dcbSVedant Kumar"""
4b7c06dcbSVedant Kumar
5b7c06dcbSVedant Kumar
6b7c06dcbSVedant Kumarimport lldb
7b7c06dcbSVedant Kumarfrom lldbsuite.test.lldbtest import *
8b7c06dcbSVedant Kumarimport lldbsuite.test.lldbutil as lldbutil
9fc8c1ea9SVedant Kumarfrom lldbsuite.test.decorators import *
10b7c06dcbSVedant Kumar
11b7c06dcbSVedant Kumar
12b7c06dcbSVedant Kumarclass ThreadStepInAvoidRegexTestCase(TestBase):
13b7c06dcbSVedant Kumar    def setUp(self):
14b7c06dcbSVedant Kumar        TestBase.setUp(self)
15*2238dcc3SJonas Devlieghere        self.line2 = line_number("main.c", "// assignment to B2")
16b7c06dcbSVedant Kumar
17b7c06dcbSVedant Kumar    @skipIfWindows
18b7c06dcbSVedant Kumar    def test_step_out_avoid_regexp(self):
19b7c06dcbSVedant Kumar        """Exercise thread step-in -r"""
20b7c06dcbSVedant Kumar        self.build()
21*2238dcc3SJonas Devlieghere        lldbutil.run_to_source_breakpoint(
22*2238dcc3SJonas Devlieghere            self,
23*2238dcc3SJonas Devlieghere            "frame select 2, thread step-out while stopped",
24*2238dcc3SJonas Devlieghere            lldb.SBFileSpec("main.c"),
25*2238dcc3SJonas Devlieghere        )
26b7c06dcbSVedant Kumar
27b7c06dcbSVedant Kumar        # Now step in, skipping the frames for 'b' and 'a'.
28b7c06dcbSVedant Kumar        self.runCmd("thread step-in -r 'a'")
29b7c06dcbSVedant Kumar
30b7c06dcbSVedant Kumar        # We should be at the assignment to B2.
31*2238dcc3SJonas Devlieghere        self.expect(
32*2238dcc3SJonas Devlieghere            "thread backtrace",
33*2238dcc3SJonas Devlieghere            STEP_IN_SUCCEEDED,
34b7c06dcbSVedant Kumar            substrs=["stop reason = step in"],
35*2238dcc3SJonas Devlieghere            patterns=["frame #0.*main.c:%d" % self.line2],
36*2238dcc3SJonas Devlieghere        )
37