public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Michael Weghorn <m.weghorn@posteo.de>
To: gdb-patches@sourceware.org
Cc: Michael Weghorn <m.weghorn@posteo.de>
Subject: [PATCH 0/8] Unify escaping/quoting of args in GDB/GDBserver
Date: Fri, 22 Oct 2021 07:19:25 +0000	[thread overview]
Message-ID: <20211022071933.3478427-1-m.weghorn@posteo.de> (raw)

Historically, args passed directly on 'gdb --args <args>' invocation
were escaped (when the inferior is started in a shell), while those passed
via 'gdbserver <args>' were not.

That was changed in commit bea571ebd78ee29cb94adf648fbcda1e109e1be6
("Use construct_inferior_arguments which handles special chars",
2020-05-25), so args passed on 'gdbserver <args>' invocation were
quoted as well.
That commit accidently also resulted in args set in target
extended-remote ('set args <args>', 'run <args>')
to be passed to the shell in a quoted way.

Based on the disussion in PR 28392
("gdb server no longer supports argument globbing and variable substitution"),
this patch series addresses this and further unifies the behaviour of
how args (set either directly on GDB/GDBserver invocation or otherwise)
are treated between GDB and GDBserver, also adding a
'--no-escape-args' command line option for GDB and
GDBserver to explicitly disable escaping of args passed directly
on invocation.
It also makes handling args with spaces work in GDBserver
when the 'startup-with-shell' option is off.

(Adding more tests to explicitly test some of the edge cases
in the testsuite probably makes sense once it is clear whether
the approach taken here is considered appropriate.)

Michael Weghorn (8):
  gdbsupport: Extract escaping from 'construct_inferior_arguments'
  gdbsupport: Make escaping in construct_inferior_arguments optional
  PR27989 PR28446 gdbserver: Only escape args passed directly on
    invocation
  PR28392 Add a '--no-escape-args' option for gdb and gdbserver
  Extract helper function from 'fork_inferior'
  Add a 'fork_inferior' overload taking vector of args
  gdbserver: Support args with spaces for no-startup-with-shell case
  gdb: Support some escaping of args with startup-with-shell being off

 gdb/fork-child.c                         |   2 +-
 gdb/infcmd.c                             |   4 +-
 gdb/inferior.h                           |   2 +-
 gdb/main.c                               |   6 +-
 gdb/nat/fork-inferior.c                  | 152 +++++++++++++----------
 gdb/nat/fork-inferior.h                  |  18 ++-
 gdb/remote.c                             |  33 +++--
 gdb/testsuite/gdb.base/args.exp          |  23 +---
 gdb/testsuite/gdb.base/inferior-args.exp |   8 +-
 gdbserver/fork-child.cc                  |  10 +-
 gdbserver/linux-low.cc                   |   4 +-
 gdbserver/netbsd-low.cc                  |   4 +-
 gdbserver/server.cc                      |  74 +++++------
 gdbserver/win32-low.cc                   |   4 +-
 gdbsupport/common-inferior.cc            | 140 +++++++++++----------
 gdbsupport/common-inferior.h             |  16 ++-
 16 files changed, 276 insertions(+), 224 deletions(-)

-- 
2.33.0


             reply	other threads:[~2021-10-22  7:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22  7:19 Michael Weghorn [this message]
2021-10-22  7:19 ` [PATCH 1/8] gdbsupport: Extract escaping from 'construct_inferior_arguments' Michael Weghorn
2021-10-22  7:19 ` [PATCH 2/8] gdbsupport: Make escaping in construct_inferior_arguments optional Michael Weghorn
2021-10-22  7:19 ` [PATCH 3/8] PR27989 PR28446 gdbserver: Only escape args passed directly on invocation Michael Weghorn
2021-10-22  7:19 ` [PATCH 4/8] PR28392 Add a '--no-escape-args' option for gdb and gdbserver Michael Weghorn
2021-10-22  7:19 ` [PATCH 5/8] Extract helper function from 'fork_inferior' Michael Weghorn
2021-10-22  7:19 ` [PATCH 6/8] Add a 'fork_inferior' overload taking vector of args Michael Weghorn
2021-10-22  7:19 ` [PATCH 7/8] gdbserver: Support args with spaces for no-startup-with-shell case Michael Weghorn
2021-10-22  7:19 ` [PATCH 8/8] gdb: Support some escaping of args with startup-with-shell being off Michael Weghorn
2021-12-06 10:47 ` [PING] [PATCH 0/8] Unify escaping/quoting of args in GDB/GDBserver Michael Weghorn
2021-12-13  7:49   ` [PING 2] " Michael Weghorn
2022-01-04  4:22     ` [PING 3] " Michael Weghorn
2022-01-04 14:26       ` Simon Marchi

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=20211022071933.3478427-1-m.weghorn@posteo.de \
    --to=m.weghorn@posteo.de \
    --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).