brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 4efd3b7 Raw
45 lines · python
1"""Test evaluating expressions which ref. index variable 'i' which just goes2from out of scope to in scope when stopped at the breakpoint."""3 4 5import lldb6from lldbsuite.test.lldbtest import *7import lldbsuite.test.lldbutil as lldbutil8 9 10class NonOverlappingIndexVariableCase(TestBase):11    def setUp(self):12        TestBase.setUp(self)13        self.source = "main.cpp"14        self.line_to_break = line_number(self.source, "// Set breakpoint here.")15 16    # rdar://problem/989053017    def test_eval_index_variable(self):18        """Test expressions of variable 'i' which appears in two for loops."""19        self.build()20        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)21 22        lldbutil.run_break_set_by_file_and_line(23            self,24            self.source,25            self.line_to_break,26            num_expected_locations=1,27            loc_exact=True,28        )29 30        self.runCmd("run", RUN_SUCCEEDED)31 32        # The stop reason of the thread should be breakpoint.33        self.expect(34            "thread list",35            STOPPED_DUE_TO_BREAKPOINT,36            substrs=["stopped", "stop reason = breakpoint"],37        )38 39        self.runCmd("frame variable i")40        self.runCmd("expr i")41        self.runCmd("expr ptr[0]->point.x")42        self.runCmd("expr ptr[0]->point.y")43        self.runCmd("expr ptr[i]->point.x")44        self.runCmd("expr ptr[i]->point.y")45