1"""
2Tests expressions evaluation when the breakpoint on module's entry is set.
3"""
4
5import lldb
6import lldbsuite.test.lldbutil as lldbutil
7from lldbsuite.test.lldbtest import *
8
9class ExprEntryBPTestCase(TestBase):
10
11    mydir = TestBase.compute_mydir(__file__)
12
13    NO_DEBUG_INFO_TESTCASE = True
14
15    def test_expr_entry_bp(self):
16        """Tests expressions evaluation when the breakpoint on module's entry is set."""
17        self.build()
18        self.main_source_file = lldb.SBFileSpec("main.c")
19
20        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, "Set a breakpoint here", self.main_source_file)
21
22        self.assertEqual(1, bkpt.GetNumLocations())
23        entry = bkpt.GetLocationAtIndex(0).GetAddress().GetModule().GetObjectFileEntryPointAddress()
24        self.assertTrue(entry.IsValid(), "Can't get a module entry point")
25
26        entry_bp = target.BreakpointCreateBySBAddress(entry)
27        self.assertTrue(entry_bp.IsValid(), "Can't set a breakpoint on the module entry point")
28
29        self.expect_expr("sum(7, 1)", result_type="int", result_value="8")
30