[Lldb-commits] [PATCH] D86996: [lldb] Add -l/--language option to script command

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 1 18:43:35 PDT 2020


JDevlieghere created this revision.
JDevlieghere added reviewers: labath, mib, l.frisken, jingham.
JDevlieghere requested review of this revision.

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, Wolrd!\n")
  Hello, Wolrd!

Because of the ability to pass anything after the `script` command, it is implemented as a `CommandObjectRaw`. In a first attempt I tried to change this to a `CommandObjectParsed` in order to have the existing infrastructure parse the language argument and have the script contents as the first argument. That didn't work out, first because it unconditionally removed quotes from within the script expression and second because it attempts to expand script commands between backticks. Given how easy it is to parse the language argument, I think it's warranted to keep the `CommandObjectRaw` and just do the parsing manually.


https://reviews.llvm.org/D86996

Files:
  lldb/source/Commands/CommandObjectScript.cpp
  lldb/test/Shell/ScriptInterpreter/Lua/lua-python.test
  lldb/test/Shell/ScriptInterpreter/Lua/lua.test
  lldb/test/Shell/ScriptInterpreter/None/none.test
  lldb/test/Shell/ScriptInterpreter/Python/python.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86996.289339.patch
Type: text/x-patch
Size: 6161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200902/3cde6673/attachment.bin>


More information about the lldb-commits mailing list