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