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/Lua/lua-python.test | |
| parent | a43e68b58b085797e2f1435765255ebd431db297 (diff) | |
[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/Lua/lua-python.test')
| -rw-r--r-- | lldb/test/Shell/ScriptInterpreter/Lua/lua-python.test | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lldb/test/Shell/ScriptInterpreter/Lua/lua-python.test b/lldb/test/Shell/ScriptInterpreter/Lua/lua-python.test new file mode 100644 index 000000000000..c40b8e068d9f --- /dev/null +++ b/lldb/test/Shell/ScriptInterpreter/Lua/lua-python.test @@ -0,0 +1,17 @@ +# REQUIRES: lua +# REQUIRES: python +# UNSUPPORTED: lldb-repro + +# RUN: mkdir -p %t +# RUN: cd %t +# RUN: echo "int main() { return 0; }" | %clang_host -x c - -o a.out +# RUN: cat %s | %lldb 2>&1 | FileCheck %s +script -l lua -- +target = lldb.debugger:CreateTarget("a.out") +print("target is valid:", tostring(target:IsValid())) +lldb.debugger:SetSelectedTarget(target) +quit +# CHECK: target is valid: true +script -l python -- +print("selected target: {}".format(lldb.debugger.GetSelectedTarget())) +# CHECK: selected target: a.out |
