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    mydir = TestBase.compute_mydir(__file__)
15
16    @skipIfWindows
17    def test_with_run_command(self):
18        self.build()
19
20        # Load symbols on-demand
21        self.runCmd("settings set symbols.load-on-demand true")
22
23        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
24
25        lldbutil.run_break_set_by_source_regexp(
26            self, "Set break point at this line.")
27        self.runCmd("run", RUN_SUCCEEDED)
28
29        # The stop reason of the thread should be breakpoint.
30        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
31                    substrs=['stopped', 'stop reason = breakpoint'])
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