summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-07-10 21:04:01 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-07-10 21:04:01 +0000
commit0171866672346f2a6e956ea97d5cc913f85b39db (patch)
treee3bbf3cf35741158516cfca7c4ac1efa4ef3dc51 /lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable
parent021ba49b31dd5cf3ff4ea5182bee36431be11bdb (diff)
downloadbcm5719-llvm-0171866672346f2a6e956ea97d5cc913f85b39db.tar.gz
bcm5719-llvm-0171866672346f2a6e956ea97d5cc913f85b39db.zip
[lldb] Fix handling of dollar characters in expr command
llvm-svn: 365698
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/expression_command/dollar-in-variable')
-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
3 files changed, 28 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'])
+}
OpenPOWER on IntegriCloud