Re: [PATCHv2] gdb: Rewrite argument handling for user-defined commands

Tom Tromey
2018-09-07T20:36:09Z

>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> This commit changes how quoting works so that the quotes are NOT now
Andrew> included in the argument passed. If the user wants to include quotes,
Andrew> they would now need to use nested quotes, so "\"abc\"" will pass the
Andrew> argument "abc".

Andrew> It is also possible to use single quotes, so '"abc"' will also pass
Andrew> the argument "abc".

Andrew> As currently there's no documentation for how quoting works in
Andrew> user-defined commands this commit adds documentation for the new
Andrew> behaviour.

Andrew> The big risk with this commit is that this does change how arguments
Andrew> are passed to user-defined commands, and this might causes issues for
Andrew> existing users.

I think this change goes against the compatibility approach I discussed
in that earlier thread -- it changes the syntax of a command in a way
that is likely to be used in practice.

In my opinion, the documentation issue in cases like this is not a
strong argument in favor of allowing a change. That's because users
will often resort to trial-and-error to get gdb to do what they want.
So unless the documentation is very clear, in practice, and especially
over long periods of time, behavior is locked to the implementation.

So, my own inclination is to say no to this patch, though I welcome &
will listen to other responses.

I'd accept a patch adding an option to define, though as I mentioned
earlier, in a case like that I think it's better to design something
very good rather than to try to patch things piecemeal; the latter being
how gdb ended up in this situation in the first place.

Tom