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."""
7 from lldbsuite.test.lldbtest import *
8 import lldbsuite.test.lldbutil as lldbutil
11 class NonOverlappingIndexVariableCase(TestBase):
13 mydir = TestBase.compute_mydir(__file__)
17 self.source = 'main.cpp'
18 self.line_to_break = line_number(
19 self.source, '// Set breakpoint here.')
21 # rdar://problem/9890530
22 def test_eval_index_variable(self):
23 """Test expressions of variable 'i' which appears in two for loops."""
25 self.runCmd("file " + self.getBuildArtifact("a.out"),
26 CURRENT_EXECUTABLE_SET)
28 lldbutil.run_break_set_by_file_and_line(
32 num_expected_locations=1,
35 self.runCmd("run", RUN_SUCCEEDED)
37 # The stop reason of the thread should be breakpoint.
38 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
40 'stop reason = breakpoint'])
42 self.runCmd('frame variable i')
44 self.runCmd('expr ptr[0]->point.x')
45 self.runCmd('expr ptr[0]->point.y')
46 self.runCmd('expr ptr[i]->point.x')
47 self.runCmd('expr ptr[i]->point.y')