public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 16/16] gdb/gdbserver: rework argument splitting and joining
Date: Sat, 20 Jan 2024 19:57:33 -0800	[thread overview]
Message-ID: <ead73938-8cc5-4046-be60-9fd2df60f62c@redhat.com> (raw)
In-Reply-To: <b39576a9faeff115419fb3fc1121ec0f861a1c8e.1704809586.git.aburgess@redhat.com>

On 1/9/24 06:26, Andrew Burgess wrote:

> I propose that the rules be something like:
> 
>    + GDB removes the quotes, and escapes all special shell characters
>      except for the following:
> 
>    + Whitespace is not escaped, the remote is expected to escape any
>      whitespace within an argument,
> 
>    + Quote characters are not escaped, the remote is expected to escape
>      any single or double quote characters within an argument.
> 
>    + Any other special shell characters will have been escaped, if
>      needed, by GDB, and the escaping included in the transmitted
>      argument.

This is a difficult situation to resolve, isn't it? After reading
through your tests, I believe I have a tiny understanding of what
these rules are doing.

In the end, you've given this far more thought (and play) than I have
while attempting to review this.

Having said that, I only have typos to point out.

> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 6ff059d14ed..cc9c5ef0ccc 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -43137,6 +43137,19 @@
>   @var{argument} string, which includes all inferior arguments,
>   separated with whitespace.
>   
> +If @value{GDBN} didn't offer @samp{single-inf-arg+}, or the remote
> +didn't choose to use this feature, then @value{GDBN} will split the
> +inferior arguments before passing them to the remote target.  Single
> +and double quotes surrounding any argument will have been removed by
> +@value{GDBN}.  Any special shell characters within each argument will
> +have been escaped with a backslash character except for quote and
> +whitespace characters, these will not be escaped within the arguments,
> +the remote target is expected to escape these characters itself.
> +
> +These slightly complex rules exist for backward compatibility reasons.
> +When implementing a new remote target it is suggested that the
> +@samp{single-inf-arg} feature be supported.

"When implementing a new remote target," (missing comma)

> +
>   @c FIXME:  What about non-stop mode?
>   
>   This packet is only available in extended mode (@pxref{extended mode}).

Keith


  parent reply	other threads:[~2024-01-21  3:57 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 14:26 [PATCH 00/16] Inferior argument (inc for remote targets) changes Andrew Burgess
2024-01-09 14:26 ` [PATCH 01/16] libiberty/buildargv: POSIX behaviour for backslash handling Andrew Burgess
2024-01-09 14:26 ` [PATCH 02/16] gdb/testsuite: add some xfail in gdb.base/startup-with-shell.exp Andrew Burgess
2024-01-09 14:26 ` [PATCH 03/16] gdb: Support some escaping of args with startup-with-shell being off Andrew Burgess
2024-01-09 14:26 ` [PATCH 04/16] gdb: remove the !startup_with_shell path from construct_inferior_arguments Andrew Burgess
2024-01-21  3:56   ` Keith Seitz
2024-01-09 14:26 ` [PATCH 05/16] gdbserver: convert program_args to a single string Andrew Burgess
2024-01-09 14:26 ` [PATCH 06/16] gdbsupport: have construct_inferior_arguments take an escape function Andrew Burgess
2024-01-09 14:26 ` [PATCH 07/16] gdbsupport: split escape_shell_characters in two Andrew Burgess
2024-01-09 14:26 ` [PATCH 08/16] gdb: move remote arg splitting and joining into gdbsupport/ Andrew Burgess
2024-01-21  3:57   ` Keith Seitz
2024-01-09 14:26 ` [PATCH 09/16] gdb/python: change escaping rules when setting arguments Andrew Burgess
2024-01-09 16:30   ` Eli Zaretskii
2024-01-09 14:26 ` [PATCH 10/16] gdb: add remote argument passing self tests Andrew Burgess
2024-01-21  3:57   ` Keith Seitz
2024-01-09 14:26 ` [PATCH 11/16] gdb/gdbserver: pass inferior arguments as a single string Andrew Burgess
2024-01-09 16:34   ` Eli Zaretskii
2024-01-09 16:35   ` Eli Zaretskii
2024-01-09 14:26 ` [PATCH 12/16] gdb/gdbserver: add a '--no-escape-args' command line option Andrew Burgess
2024-01-09 16:43   ` Eli Zaretskii
2024-01-21  3:57   ` Keith Seitz
2024-01-09 14:26 ` [PATCH 13/16] gdb: allow 'set args' and run commands to contain newlines Andrew Burgess
2024-01-09 16:44   ` Eli Zaretskii
2024-01-21  3:57   ` Keith Seitz
2024-01-09 14:26 ` [PATCH 14/16] gdb/gdbserver: remove some uses of free_vector_argv Andrew Burgess
2024-01-09 14:26 ` [PATCH 15/16] gdb: new maintenance command to help debug remote argument issues Andrew Burgess
2024-01-09 16:32   ` Eli Zaretskii
2024-01-21  3:57   ` Keith Seitz
2024-01-09 14:26 ` [PATCH 16/16] gdb/gdbserver: rework argument splitting and joining Andrew Burgess
2024-01-09 16:37   ` Eli Zaretskii
2024-01-21  3:57   ` Keith Seitz [this message]
2024-01-09 16:58 ` [PATCH 00/16] Inferior argument (inc for remote targets) changes Eli Zaretskii
2024-01-20 22:46   ` Andrew Burgess
2024-01-21 10:22     ` Eli Zaretskii
2024-01-22 10:29       ` Andrew Burgess
2024-01-10  8:28 ` Michael Weghorn
2024-01-21  3:56 ` Keith Seitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ead73938-8cc5-4046-be60-9fd2df60f62c@redhat.com \
    --to=keiths@redhat.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).