)]}'
{
  "commit": "f1f0a06d5b34231edd75fbd71a3be79097437f62",
  "tree": "26d202ddaf31e626e0205e5010a5c1833eb5f629",
  "parents": [
    "b75b3eb082b9ee25be98e9cebe1ae5e665a682fc"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Tue Sep 26 17:32:24 2023 +0100"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Fri Oct 06 13:02:36 2023 +0100"
  },
  "message": "gdbserver: fix handling of single quote arguments\n\nI noticed that passing arguments containing single quotes to gdbserver\ndidn\u0027t work correctly:\n\n  gdb -ex \u0027set sysroot\u0027 --args /tmp/show-args\n  Reading symbols from /tmp/show-args...\n  (gdb) target extended-remote | gdbserver --once --multi - /tmp/show-args\n  Remote debugging using | gdbserver --once --multi - /tmp/show-args\n  stdin/stdout redirected\n  Process /tmp/show-args created; pid \u003d 176054\n  Remote debugging using stdio\n  Reading symbols from /lib64/ld-linux-x86-64.so.2...\n  (No debugging symbols found in /lib64/ld-linux-x86-64.so.2)\n  0x00007ffff7fd3110 in _start () from /lib64/ld-linux-x86-64.so.2\n  (gdb) set args \\\u0027\n  (gdb) r\n  The program being debugged has been started already.\n  Start it from the beginning? (y or n) y\n  Starting program: /tmp/show-args \\\u0027\n  stdin/stdout redirected\n  Process /tmp/show-args created; pid \u003d 176088\n  2 args are:\n    /tmp/show-args\n    \\\u0027\n  Done.\n  [Inferior 1 (process 176088) exited normally]\n  (gdb) target native\n  Done.  Use the \"run\" command to start a process.\n  (gdb) run\n  Starting program: /tmp/show-args \\\u0027\n  2 args are:\n    /tmp/show-args\n    \u0027\n  Done.\n  [Inferior 1 (process 176095) exited normally]\n  (gdb) q\n\nThe \u0027shows-args\u0027 program used here just prints the arguments passed to\nthe inferior.\n\nNotice that when starting the inferior using the extended-remote\ntarget the second argument is \"\\\u0027\", while when running using native\ntarget the argument is \"\u0027\".  The second of these is correct, the \\\u0027\nused with the \"set args\" command is just to show GDB that the single\nquote is not opening an argument string.\n\nIt turns out that the extra backslash is injected on the gdbserver\nside when gdbserver processes the arguments that GDB passes it, the\ncode that does this was added as part of this much larger commit:\n\n  commit 2090129c36c7e582943b7d300968d19b46160d84\n  Date:   Thu Dec 22 21:11:11 2016 -0500\n\n      Share fork_inferior et al with gdbserver\n\nIn this commit I propose removing the specific code that adds what I\nbelieve is a stray backslash.  I\u0027ve extended an existing test to cover\nthis case, and I now see identical behaviour when using an\nextended-remote target as with the native target.\n\nThis partially fixes PR gdb/27989, though there are still some issues\nwith newline handling which I\u0027ll address in a later commit.\n\nDuring review I was pointed to this older series:\n\n  https://inbox.sourceware.org/gdb-patches/20211022071933.3478427-1-m.weghorn@posteo.de/\n\nwhich also includes this fix as part of a larger set of changes.  I\u0027m\ngiving a Co-Authored-By credit to the author of that original series.\nI believe this smaller fix brings some benefits on its own, though the\noriginal series does offer additional improvements.  Once this is\nmerged I\u0027ll take a look at rebasing and resubmitting the original series.\n\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id\u003d27989\n\nCo-Authored-By: Michael Weghorn \u003cm.weghorn@posteo.de\u003e\nApproved-By: Tom Tromey \u003ctom@tromey.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "0b55c4444aa91f1dab3d8b39c2a7fd370101fc7f",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/args.exp",
      "new_id": "092b44bd61d8e10cd24df4458011c3ada609a655",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/args.exp"
    },
    {
      "type": "modify",
      "old_id": "19bada6d2c766693c5f3c2d5d4f949b74ee1f962",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/inferior-args.exp",
      "new_id": "3d3cd39a706d8ea5409bb511dbf729bddb3a5b36",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/inferior-args.exp"
    },
    {
      "type": "modify",
      "old_id": "c57270175b46714ed67a662988c138ce7d5700b6",
      "old_mode": 33188,
      "old_path": "gdbserver/server.cc",
      "new_id": "496b9bebb7d73dfa48c2f742265d3664ac300057",
      "new_mode": 33188,
      "new_path": "gdbserver/server.cc"
    }
  ]
}
