gdbserver: handle newlines in inferior arguments
authorAndrew Burgess <aburgess@redhat.com>
Wed, 27 Sep 2023 16:54:15 +0000 (17:54 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 6 Oct 2023 12:02:36 +0000 (13:02 +0100)
commit67e6945b7e3a5c1577d19b9d83ee9be86c0a8424
tree3b6c7464e64ecc4895df69753dcb5e5d6e2a553c
parent7663126c0b8246754990ce57a2c8432c2d0e4cc9
gdbserver: handle newlines in inferior arguments

Similarly to how single quotes were mishandled, which was fixed two
commits ago, this commit fixes handling of newlines in arguments
passed to gdbserver.

We already had a test that covered this, gdb.base/args.exp, which,
when run with the native-extended-gdbserver board contained several
KFAIL covering this situation.

In this commit I remove the unnecessary, attempt to quote incoming
newlines within arguments, and do some minimal cleanup of the related
code.  There is additional cleanup that can be done, but I'm leaving
that for the next commit.

Then I've removed the KFAIL from the test case, and performed some
minimal cleanup there too.

After this commit the gdb.base/args.exp is 100% passing with the
native-extended-gdbserver board file.

During review I was pointed to this older series:

  https://inbox.sourceware.org/gdb-patches/20211022071933.3478427-1-m.weghorn@posteo.de/

which also includes this fix as part of a larger set of changes.  I'm
giving a Co-Authored-By credit to the author of that original series.
I believe this smaller fix brings some benefits on its own, though the
original series does offer additional improvements.  Once this is
merged I'll take a look at rebasing and resubmitting the original series.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27989

Co-Authored-By: Michael Weghorn <m.weghorn@posteo.de>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.base/args.exp
gdbserver/server.cc