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

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 3 00:21:37 PDT 2020

labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

In D86996#2252561 <https://reviews.llvm.org/D86996#2252561>, @JDevlieghere wrote:

> In D86996#2252520 <https://reviews.llvm.org/D86996#2252520>, @JDevlieghere wrote:
>> In D86996#2252246 <https://reviews.llvm.org/D86996#2252246>, @labath wrote:
>>> I agree that silly, but maybe the same fix should then be applied to the `expr` command (and any other command with similar behavior).
>> Sure, we can use the same trick in other places that use `OptionsWithRaw`. I'll do that in a separate patch.
> Actually, after discussion this with @teemperor offline, for the `expo` command we can't use that trick because a valid option might also be a valid expression. `expr --flag` would parse correctly if flag was an option, but it might also be an expression that decrements `--flag`.

That's actually a very good point. But... that also applies to the script command. With python `script --flag` returns the value of the flag variable (negated twice). With lua, it executes the command "--flag", which is a comment. Neither of these are as useful as the c++ `--flag`, but they still create ambiguities. And I think these commands should disambiguate in the same way. No matter what we choose as the primary interpretation, the "other" meaning can always be obtained by adding a `--` to the appropriate place, so it's only a matter of choosing the best default. Given the `expr` status quo, I'd stick with that.



More information about the lldb-commits mailing list