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