)]}'
{
  "commit": "512ca2fca4b6674d51706d0d7fe21ed72f733fb5",
  "tree": "150acf6f90fb06b0f09477f2edc332d5243bd541",
  "parents": [
    "710f7df7da31dc6b81cdbdd7256005c51798260a"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Sat Nov 02 17:35:14 2024 +0000"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Tue Mar 18 13:03:07 2025 +0000"
  },
  "message": "gdb: split up construct_inferior_arguments\n\nThe function construct_inferior_arguments (gdbsupport/common-inferior.cc)\ncurrently escapes all special shell characters.  After this commit\nthere will be two \"levels\" of quoting:\n\n  1. The current \"full\" quoting, where all posix shell special\n  characters are quoted, and\n\n  2. a new \"reduced\" quoting, where only the characters that GDB sees\n  as special (quotes and whitespace) are quoted.\n\nAfter this, almost all construct_inferior_arguments calls will use the\n\"full\" quoting, which is the current quoting.  The \"reduced\" quoting\nwill be used in this commit to restore the behaviour that was lost in\nthe previous commit (more details below).\n\nIn the future, the reduced quoting will be useful for some additional\ninferior argument that I have planned.  I already posted my full\ninferior argument work here:\n\n  https://inbox.sourceware.org/gdb-patches/cover.1730731085.git.aburgess@redhat.com\n\nBut that series is pretty long, and wasn\u0027t getting reviewed, so I\u0027m\nposted the series in parts now.\n\nBefore the previous commit, GDB behaved like this:\n\n  $ gdb -eiex \u0027set startup-with-shell off\u0027 --args /tmp/exec \u0027$FOO\u0027\n  (gdb) show args\n  Argument list to give program being debugged when it is started is \"$FOO\".\n\nNotice that with \u0027startup-with-shell\u0027 off, the argument was left as\njust \u0027$FOO\u0027.  But after the previous commit, this changed to:\n\n  $ gdb -eiex \u0027set startup-with-shell off\u0027 --args /tmp/exec \u0027$FOO\u0027\n  (gdb) show args\n  Argument list to give program being debugged when it is started is \"\\$FOO\".\n\nNow the \u0027$\u0027 is escaped with a backslash.  This commit restores the\noriginal behaviour, as this is (currently) the only way to unquoted\nshell special characters into arguments from the GDB command line.\nThe series that I listed above includes a new command line option for\nGDB which provides a better approach for controlling the quoting of\nspecial shell characters, but that work requires these patches to be\nmerged first.\n\nI\u0027ve split out the core of construct_inferior_arguments into the new\nfunction escape_characters, which takes a set of characters to escape.\nThen the two functions escape_shell_characters and\nescape_gdb_characters call escape_characters with the appropriate\ncharacter sets.\n\nFinally, construct_inferior_arguments, now takes a boolean which\nindicates if we should perform full shell escaping, or just perform\nthe reduced escaping.\n\nI\u0027ve updated all uses of construct_inferior_arguments to pass a\nsuitable value to indicate what escaping to perform (mostly just\n\u0027true\u0027, but one case in main.c is different), also I\u0027ve updated\ninferior::set_args to take the same boolean flag, and pass it through\nto construct_inferior_arguments.\n\nTested-By: Guinevere Larsen \u003cguinevere@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "4662b5c6fc749e2688faeda72f9eb1032b600577",
      "old_mode": 33188,
      "old_path": "gdb/corelow.c",
      "new_id": "567ecd5c5712214c30bd474513e2604d8db1d094",
      "new_mode": 33188,
      "new_path": "gdb/corelow.c"
    },
    {
      "type": "modify",
      "old_id": "67d70c5c2fb1cad10a8c99f085bee93dc7a0a25a",
      "old_mode": 33188,
      "old_path": "gdb/inferior.c",
      "new_id": "6472d49616cb42934c2e01c280c93caadd21576d",
      "new_mode": 33188,
      "new_path": "gdb/inferior.c"
    },
    {
      "type": "modify",
      "old_id": "3d9f86c0d4a4c5fc9a4b7402eeafbe73ebb94d72",
      "old_mode": 33188,
      "old_path": "gdb/inferior.h",
      "new_id": "327a474380f81d9f469a6978702f691a18efe352",
      "new_mode": 33188,
      "new_path": "gdb/inferior.h"
    },
    {
      "type": "modify",
      "old_id": "27043b748855e11fe359c982c3da1d3916aa4a74",
      "old_mode": 33188,
      "old_path": "gdb/main.c",
      "new_id": "d126e98e16f231afbdc0944940fad8c2d3787179",
      "new_mode": 33188,
      "new_path": "gdb/main.c"
    },
    {
      "type": "modify",
      "old_id": "d11ca9e6506949441d1706a43136256328588d15",
      "old_mode": 33188,
      "old_path": "gdb/python/py-inferior.c",
      "new_id": "356961cfbcb39d6074fdc8adfd051f2c0735664c",
      "new_mode": 33188,
      "new_path": "gdb/python/py-inferior.c"
    },
    {
      "type": "modify",
      "old_id": "3d452f91686d5c1089de3dc7f8bb31cb72cc1856",
      "old_mode": 33188,
      "old_path": "gdbserver/server.cc",
      "new_id": "def01c1ee803088b609b8b05a9c3842c0cf86fa1",
      "new_mode": 33188,
      "new_path": "gdbserver/server.cc"
    },
    {
      "type": "modify",
      "old_id": "8e35f416e7081db9b24c1a973ee5134c3249a651",
      "old_mode": 33188,
      "old_path": "gdbsupport/common-inferior.cc",
      "new_id": "4b8682940626a9f6a4d43d33c72478f0eb821ac1",
      "new_mode": 33188,
      "new_path": "gdbsupport/common-inferior.cc"
    },
    {
      "type": "modify",
      "old_id": "ef99815894515a64c3f80e768b5157b382f0e412",
      "old_mode": 33188,
      "old_path": "gdbsupport/common-inferior.h",
      "new_id": "3e8ec10df9bc65db862113a4e0eaf44099a17e49",
      "new_mode": 33188,
      "new_path": "gdbsupport/common-inferior.h"
    }
  ]
}
