diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2020-09-15 09:36:28 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2020-09-15 09:40:17 -0700 |
commit | 127faae7529aee7e8508abebbc19212ce30bbf27 (patch) | |
tree | ba439ffff10ab93c7d08df1eccf37d6e348ed1d0 /lldb/test/Shell/ScriptInterpreter/Python | |
parent | a43e68b58b085797e2f1435765255ebd431db297 (diff) | |
download | llvm-127faae7529aee7e8508abebbc19212ce30bbf27.zip llvm-127faae7529aee7e8508abebbc19212ce30bbf27.tar.gz llvm-127faae7529aee7e8508abebbc19212ce30bbf27.tar.bz2 |
[lldb] Add -l/--language option to script command
Make it possible to run the script command with a different language
than currently selected.
$ ./bin/lldb -l python
(lldb) script -l lua
>>> io.stdout:write("Hello, World!\n")
Hello, World!
When passing the language option and a raw command, you need to separate
the flag from the script code with --.
$ ./bin/lldb -l python
(lldb) script -l lua -- io.stdout:write("Hello, World!\n")
Hello, World!
Differential revision: https://reviews.llvm.org/D86996
Diffstat (limited to 'lldb/test/Shell/ScriptInterpreter/Python')
-rw-r--r-- | lldb/test/Shell/ScriptInterpreter/Python/python.test | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/python.test b/lldb/test/Shell/ScriptInterpreter/Python/python.test new file mode 100644 index 0000000..77d2029 --- /dev/null +++ b/lldb/test/Shell/ScriptInterpreter/Python/python.test @@ -0,0 +1,13 @@ +# REQUIRES: python +# RUN: %lldb --script-language python -o 'script print("{}".format(1000+100+10+1))' 2>&1 | FileCheck %s +# RUN: %lldb --script-language python -o 'script -- print("{}".format(1000+100+10+1))' 2>&1 | FileCheck %s +# RUN: %lldb --script-language python -o 'script --language default -- print("{}".format(1000+100+10+1))' 2>&1 | FileCheck %s +# RUN: %lldb -o 'script -l python -- print("{}".format(1000+100+10+1))' 2>&1 | FileCheck %s +# RUN: %lldb -o 'script -lpython -- print("{}".format(1000+100+10+1))' 2>&1 | FileCheck %s +# RUN: %lldb -o 'script --language python -- print("{}".format(1000+100+10+1))' 2>&1 | FileCheck %s +# RUN: %lldb -o 'script --language=python -- print("{}".format(1000+100+10+1))' 2>&1 | FileCheck %s +# CHECK: 1111 + +# RUN: %lldb -o 'script --language invalid -- print("{}".format(1000+100+10+1))' 2>&1 | FileCheck %s --check-prefix INVALID +# INVALID: error: unrecognized value for language 'invalid' +# INVALID-NOT: 1111 |