summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/expression_command
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/expression_command')
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/Makefile3
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/TestDollarInVariable.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/main.c21
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/Makefile4
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/TestUnicodeInVariable.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/main.cpp17
6 files changed, 53 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/Makefile b/lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/Makefile
new file mode 100644
index 00000000000..f5a47fcc46c
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/TestDollarInVariable.py b/lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/TestDollarInVariable.py
new file mode 100644
index 00000000000..03424658f3e
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/TestDollarInVariable.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), None)
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/main.c b/lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/main.c
new file mode 100644
index 00000000000..e5fec25b35b
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable/main.c
@@ -0,0 +1,21 @@
+// Make sure we correctly handle $ in variable names.
+
+int main() {
+ // Some variables that might conflict with our variables below.
+ int __lldb_expr_result = 2;
+ int $$foo = 1;
+ int R0 = 2;
+
+ // Some variables with dollar signs that should work (and shadow
+ // any built-in LLDB variables).
+ int $__lldb_expr_result = 11;
+ int $foo = 12;
+ int $R0 = 13;
+ int $0 = 14;
+
+ //%self.expect("expr $__lldb_expr_result", substrs=['(int) $0 = 11'])
+ //%self.expect("expr $foo", substrs=['(int)', ' = 12'])
+ //%self.expect("expr $R0", substrs=['(int)', ' = 13'])
+ //%self.expect("expr int $foo = 123", error=True, substrs=["declaration conflicts"])
+ return 0; //%self.expect("expr $0", substrs=['(int)', ' = 14'])
+}
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/Makefile b/lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/Makefile
new file mode 100644
index 00000000000..3759b5f9255
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/Makefile
@@ -0,0 +1,4 @@
+LEVEL = ../../make
+CXX_SOURCES := main.cpp
+CXX_FLAGS_EXTRA := -finput-charset=UTF-8 -fextended-identifiers
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/TestUnicodeInVariable.py b/lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/TestUnicodeInVariable.py
new file mode 100644
index 00000000000..03424658f3e
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/TestUnicodeInVariable.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), None)
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/main.cpp b/lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/main.cpp
new file mode 100644
index 00000000000..82e38b1ef4c
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/expression_command/unicode-in-variable/main.cpp
@@ -0,0 +1,17 @@
+// Make sure we correctly handle unicode in variable names.
+
+struct A {
+ // We need a member variable in the context that could shadow our local
+ // variable. If our optimization code fails to handle this, then we won't
+ // correctly inject our local variable so that it won't get shadowed.
+ int foob\u00E1r = 2;
+ int foo() {
+ int foob\u00E1r = 3;
+ return foob\u00E1r; //%self.expect("expr foobár", substrs=['(int)', ' = 3'])
+ }
+};
+
+int main() {
+ A a;
+ return a.foo();
+}
OpenPOWER on IntegriCloud