summaryrefslogtreecommitdiffstats
path: root/lldb/test/expression_command/persistent_variables
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/expression_command/persistent_variables')
-rw-r--r--lldb/test/expression_command/persistent_variables/Makefile5
-rw-r--r--lldb/test/expression_command/persistent_variables/TestPersistentVariables.py45
-rw-r--r--lldb/test/expression_command/persistent_variables/main.c13
3 files changed, 63 insertions, 0 deletions
diff --git a/lldb/test/expression_command/persistent_variables/Makefile b/lldb/test/expression_command/persistent_variables/Makefile
new file mode 100644
index 00000000000..0d70f259501
--- /dev/null
+++ b/lldb/test/expression_command/persistent_variables/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/test/expression_command/persistent_variables/TestPersistentVariables.py b/lldb/test/expression_command/persistent_variables/TestPersistentVariables.py
new file mode 100644
index 00000000000..b1ff042f2d2
--- /dev/null
+++ b/lldb/test/expression_command/persistent_variables/TestPersistentVariables.py
@@ -0,0 +1,45 @@
+"""
+Test that lldb persistent variables works correctly.
+"""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+
+class PersistentVariablesTestCase(TestBase):
+
+ mydir = os.path.join("expression_command", "persistent_variables")
+
+ def test_persistent_variables(self):
+ """Test that lldb persistent variables works correctly."""
+ self.buildDefault()
+
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ self.runCmd("breakpoint set --name main")
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ self.expect("expression int $i = 5; $i + 1",
+ startstr = "(int) $0 = 6")
+ # (int) $0 = 6
+
+ self.expect("expression $i + 3",
+ startstr = "(int) $1 = 8")
+ # (int) $1 = 8
+
+ self.expect("expression $1 + $0",
+ startstr = "(int) $2 = 14")
+ # (int) $2 = 14
+
+ self.expect("expression $2",
+ startstr = "(int) $3 = 14")
+ # (int) $3 = 14
+
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
diff --git a/lldb/test/expression_command/persistent_variables/main.c b/lldb/test/expression_command/persistent_variables/main.c
new file mode 100644
index 00000000000..343eac7e554
--- /dev/null
+++ b/lldb/test/expression_command/persistent_variables/main.c
@@ -0,0 +1,13 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main (int argc, char const *argv[])
+{
+ return 0;
+}
OpenPOWER on IntegriCloud