aboutsummaryrefslogtreecommitdiff
path: root/gdbserver
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-09-27 17:54:15 +0100
committerAndrew Burgess <aburgess@redhat.com>2023-10-06 13:02:36 +0100
commit67e6945b7e3a5c1577d19b9d83ee9be86c0a8424 (patch)
tree3b6c7464e64ecc4895df69753dcb5e5d6e2a553c /gdbserver
parent7663126c0b8246754990ce57a2c8432c2d0e4cc9 (diff)
downloadgdb-67e6945b7e3a5c1577d19b9d83ee9be86c0a8424.zip
gdb-67e6945b7e3a5c1577d19b9d83ee9be86c0a8424.tar.gz
gdb-67e6945b7e3a5c1577d19b9d83ee9be86c0a8424.tar.bz2
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>
Diffstat (limited to 'gdbserver')
-rw-r--r--gdbserver/server.cc17
1 files changed, 0 insertions, 17 deletions
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index d78eb5a..84b8712 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -2997,34 +2997,17 @@ handle_v_run (char *own_buf)
/* These are pointers used to navigate the strings above. */
char *tmp_arg = arg;
char *tmp_full_arg = full_arg;
- int need_quote = 0;
hex2bin (p, (gdb_byte *) arg, len);
arg[len] = '\0';
while (*tmp_arg != '\0')
{
- switch (*tmp_arg)
- {
- case '\n':
- /* Quote \n. */
- *tmp_full_arg = '\'';
- ++tmp_full_arg;
- need_quote = 1;
- break;
-
- default:
- break;
- }
-
*tmp_full_arg = *tmp_arg;
++tmp_full_arg;
++tmp_arg;
}
- if (need_quote)
- *tmp_full_arg++ = '\'';
-
/* Finish FULL_ARG and push it into the vector containing
the argv. */
*tmp_full_arg = '\0';