summaryrefslogtreecommitdiffstats
path: root/lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-08-03 01:34:29 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-08-03 01:34:29 +0000
commitcf901ed229a15fb1f12ac6c8979b5e70936fa355 (patch)
tree314427e2751e2fcf0ecbe01a82369fae88bac842 /lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
parentdc9cbaaf239d3ad929375f712d947b1db146b201 (diff)
downloadbcm5719-llvm-cf901ed229a15fb1f12ac6c8979b5e70936fa355.tar.gz
bcm5719-llvm-cf901ed229a15fb1f12ac6c8979b5e70936fa355.zip
Add a test file to go with r136745. It fails, though, for:
expr ptr[i]->point.x Radar to be filed. llvm-svn: 136760
Diffstat (limited to 'lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py')
-rw-r--r--lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py b/lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
new file mode 100644
index 00000000000..c4488104d68
--- /dev/null
+++ b/lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
@@ -0,0 +1,52 @@
+"""Test evaluating expressions which ref. index variable 'i' which just goes
+from out of scope to in scope when stopped at the breakpoint."""
+
+import unittest2
+import lldb
+from lldbtest import *
+
+class NonOverlappingIndexVariableCase(TestBase):
+
+ mydir = os.path.join("functionalities", "non-overlapping-index-variable-i")
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.source = 'main.cpp'
+ self.line_to_break = line_number(self.source, '// Set breakpoint here.')
+ self.lldb_avg = None
+ self.gdb_avg = None
+
+ def test_eval_index_variable(self):
+ """Test expressions of variable 'i' which appears in two for loops."""
+ self.buildDefault()
+ self.exe_name = 'a.out'
+ self.eval_index_variable_i(self.exe_name)
+
+ def eval_index_variable_i(self, exe_name):
+ """Test expressions of variable 'i' which appears in two for loops."""
+ self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
+
+ self.expect('breakpoint set -f %s -l %d' % (self.source, self.line_to_break),
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+ (self.source, self.line_to_break))
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ self.runCmd('frame variable i')
+ self.runCmd('expr i')
+ self.runCmd('expr ptr[0]->point.x')
+ self.runCmd('expr ptr[0]->point.y')
+ self.runCmd('expr ptr[i]->point.x')
+ self.runCmd('expr ptr[i]->point.y')
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
OpenPOWER on IntegriCloud