1 """Test evaluating expressions which ref. index variable 'i' which just goes
2 from out of scope to in scope when stopped at the breakpoint."""
6 from lldbsuite
.test
.lldbtest
import *
7 import lldbsuite
.test
.lldbutil
as lldbutil
10 class NonOverlappingIndexVariableCase(TestBase
):
13 self
.source
= "main.cpp"
14 self
.line_to_break
= line_number(self
.source
, "// Set breakpoint here.")
16 # rdar://problem/9890530
17 def test_eval_index_variable(self
):
18 """Test expressions of variable 'i' which appears in two for loops."""
20 self
.runCmd("file " + self
.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET
)
22 lldbutil
.run_break_set_by_file_and_line(
26 num_expected_locations
=1,
30 self
.runCmd("run", RUN_SUCCEEDED
)
32 # The stop reason of the thread should be breakpoint.
35 STOPPED_DUE_TO_BREAKPOINT
,
36 substrs
=["stopped", "stop reason = breakpoint"],
39 self
.runCmd("frame variable 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")