[Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 29 07:53:20 PST 2016

On 28 November 2016 at 18:06, Jim Ingham <jingham at apple.com> wrote:
> backtick parsing is currently incorrect, because it parses the backtick
> before doing arg parsing, which means it does the substitutions for “raw”
> commands:
> (lldb) expr char *$foo = "some `1 + 2` string"
> (lldb) expr $foo
> (char *) $foo = 0x000000010032f100 "some 3 string"
> That’s unexpected, and since part of the point of expr is that you can
> freely cut and paste from a source view into the expr command, it is not
> desirable.
Agreed, although I do not think this requirement conflicts with the
requirements above (btw, I like the raw mode very much)

> The most straightforward way to fix this is to make backtick parsing happen
> as a part of argument parsing - so you would know you were in a raw command
> and not intervene in the input.
> I actually think the full bash quoting rules are overly complex for lldb.
> Greg was having fun emulating the bash syntax but that seems an
> unnecessarily complex model for lldb’s command line.  But that may be water
> under the bridge at this point.

I'll have to take some of the blame for that. One of my first changes
on this project was fixing quote processing. :) I think it was a
strict improvement, as back then we get very inconsistent quoting and
unquoting rules, which produced very strange results in more
complicated cases (e.g. prefixing a command with "lldb --" is able to
run it in a debugger in almost all cases, before it broke down as soon
as arguments contained quotes). I chose to model it after posix
shells, as the rules very already quite similar to that, and I thought
(and still do) that sticking known rules is better than trying to
invent new ones.

I hope I'll find more time to go back to that soon and finish the
remaining bugs we have mentioned here.


More information about the lldb-commits mailing list