[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
Wed Sep 2 01:48:28 PDT 2020

JDevlieghere added a comment.

In D86996#2251485 <https://reviews.llvm.org/D86996#2251485>, @teemperor wrote:

> So CommandObjectRaw does support arguments, but they way it works is that you need to have a delimiter for the 'raw' part which is `--`. If you have that, then you can just use invoke the normal option parsing like CommandObjectExpression does. The handcrafted implementation here adds a completely new lldb command syntax which has a 'raw' part without the `--` which seems inconsistent (not saying that the syntax here is worse or better than `script --language foo --`, but it's just inconsistent with the way the rest of LLDB works). It's obviously also missing the other quirky things that are part of the command syntax (e.g., quoting arguments isn't supported and so on).

Yes, I really wanted to avoid that, and after spending (way too much time) trying to hack that up I concluded that with the lossy conversion to `Args` that really wasn't an option (pun intended?). So using the delimiter is indeed what I ended up settling for. I did add a special case for the situation where you pass a language but no code, because I thought it would be silly to require you to type `script --language lua --` to launch the interactive Lua interpreter.



More information about the lldb-commits mailing list