[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
Fri Sep 4 05:45:54 PDT 2020

labath added a comment.

I'm not married to the current way we process commands, but I do value their consistency (both between different commands, and between a command and their documentation). This would make `script` behave differently than `expr` even though they have identical modes of operation (raw input, special handling of empty argument, etc.), and differently from its documentation. The `help script` command contains this:

  Invoke the script interpreter with provided code and display any results.  Start the interactive
  interpreter if no code is supplied.  Expects 'raw' input (see 'help raw-input'.)

I'm not sure how this is patch coded, but probably after the argument are added, this additional snippet will appear:

  Important Note: Because this command takes 'raw' input, if you use any command options you must use
   ' -- ' between the end of the command options and the beginning of the raw input.

`help raw-input` says this:

  <raw-input> -- Free-form text passed to a command without prior interpretation, allowing spaces
                 without requiring quotes.  To pass arguments and free form text put two dashes ' -- '
                 between the last argument and any raw input.

If we do want to change that, we should at least make sure all of these things reflect that. And yeah, that should be a separate patch (maybe a small RFC even).

FWIW, if we do want to change the handling of raw-commands, I don't think changing that for _all_ raw commands (including `expr`) would be such a bad thing.  Users mostly interact with the expression command via the `p` alias, which already includes the `--` thingy in its expansion. And for the advanced uses of these commands, we could still tell a consistent story (e.g. option processing stops at the first token which does not look like an option, and everything after that is considered to be the "raw" part).



More information about the lldb-commits mailing list