1"""
2Test source text regex breakpoint hydrates module debug info
3in symbol on-demand mode.
4"""
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class TestSourceTextRegexBreakpoint(TestBase):
14    @skipIfWindows
15    def test_with_run_command(self):
16        self.build()
17
18        # Load symbols on-demand
19        self.runCmd("settings set symbols.load-on-demand true")
20
21        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
22
23        lldbutil.run_break_set_by_source_regexp(self, "Set break point at this line.")
24        self.runCmd("run", RUN_SUCCEEDED)
25
26        # The stop reason of the thread should be breakpoint.
27        self.expect(
28            "thread list",
29            STOPPED_DUE_TO_BREAKPOINT,
30            substrs=["stopped", "stop reason = breakpoint"],
31        )
32
33        frame = self.frame()
34        self.assertTrue(frame.IsValid())
35        self.assertEqual(frame.GetLineEntry().GetFileSpec().GetFilename(), "main.cpp")
36        self.assertEqual(frame.GetLineEntry().GetLine(), 4)
37