Re: [PATCH 2/2] gdb: Allow parenthesis to group arguments to user-defined commands

Eli Zaretskii
2018-08-15T18:24:51Z

> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Cc: Andrew Burgess <andrew.burgess@embecosm.com>
> Date: Wed, 15 Aug 2018 15:39:20 +0100
>
> When calling a user-defined command then currently, arguments are
> whitespace separated. This means that it is impossible to pass a
> single argument that contains a whitespace.
>
> The exception to the no whitespace rule is strings, a string argument,
> enclosed in double, or single quotes, can contain whitespace.
>
> However, if a user wants to reference, for example, a type name that
> contains a space, as in these examples:
>
> user_command *((unsigned long long *) some_pointer)
>
> user_command {unsigned long long}some_pointer
>
> then this will not work, as the whitespace between 'unsigned' and
> 'long', as well as the whitespace between 'long' and 'long', will mean
> GDB interprets this as many arguments.
>
> The solution proposed in this patch is to allow parenthesis to be used
> to group arguments, so the use could now write:
>
> user_command (*((unsigned long long *) some_pointer))
>
> user_command ({unsigned long long}some_pointer)
>
> And GDB will interpret these as a single argument.
>
> gdb/ChangeLog:
>
> * cli/cli-script.c (user_args::user_args): Allow parenthesis to
> group arguments.
>
> gdb/testsuite/ChangeLog:
>
> * gdb.base/commands.exp (args_with_whitespace): New proc, which is
> added to the list of procs to call.
> * gdb.base/run.c (global_var): Defined global.
>
> gdb/doc/ChangeLog:
>
> * gdb.texinfo (Define): Additional documentation about argument
> syntax.
> ---
> gdb/ChangeLog | 5 ++++
> gdb/cli/cli-script.c | 8 +++++-
> gdb/doc/ChangeLog | 5 ++++
> gdb/doc/gdb.texinfo | 54 +++++++++++++++++++++++++++++++++----
> gdb/testsuite/ChangeLog | 6 +++++
> gdb/testsuite/gdb.base/commands.exp | 36 +++++++++++++++++++++++++
> gdb/testsuite/gdb.base/run.c | 3 +++
> 7 files changed, 111 insertions(+), 6 deletions(-)

OK for the documentation parts.

Thanks.