[lldb] Add -l/--language option to script command
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 15 Sep 2020 16:36:28 +0000 (09:36 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 15 Sep 2020 16:40:17 +0000 (09:40 -0700)
commit127faae7529aee7e8508abebbc19212ce30bbf27
treeba439ffff10ab93c7d08df1eccf37d6e348ed1d0
parenta43e68b58b085797e2f1435765255ebd431db297
[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
lldb/source/Commands/CommandObjectScript.cpp
lldb/source/Commands/CommandObjectScript.h
lldb/source/Commands/Options.td
lldb/test/Shell/ScriptInterpreter/Lua/lua-python.test [new file with mode: 0644]
lldb/test/Shell/ScriptInterpreter/Lua/lua.test
lldb/test/Shell/ScriptInterpreter/Python/python.test [new file with mode: 0644]
llvm/lib/Support/MemoryBuffer.cpp