)]}'
{
  "commit": "91265a7d7cddc10314335ffcfbfae7159c7cecb1",
  "tree": "3449a623ebe58d5e59ea3c72eb9be336cc0dbc03",
  "parents": [
    "751495be92b2b319fb66ce4e12b562a0e27c15fe"
  ],
  "author": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Wed Feb 08 16:06:23 2023 +0000"
  },
  "committer": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Wed Feb 15 20:58:00 2023 +0000"
  },
  "message": "Add new \"$_shell(CMD)\" internal function\n\nFor testing a following patch, I wanted a way to send a SIGINT to GDB\nfrom a breakpoint condition.  And I didn\u0027t want to do it from a Python\nbreakpoint or Python function, as I wanted to exercise non-Python code\npaths.  So I thought I\u0027d add a new $_shell internal function, that\nruns a command under the shell, and returns the exit code.  With this,\nI could write:\n\n  (gdb) b foo if $_shell(\"kill -SIGINT $gdb_pid\") !\u003d 0 || \u003cother condition\u003e\n\nI think this is generally useful, hence I\u0027m proposing it here.\n\nHere\u0027s the new function in action:\n\n (gdb) p $_shell(\"true\")\n $1 \u003d 0\n (gdb) p $_shell(\"false\")\n $2 \u003d 1\n (gdb) p $_shell(\"echo hello\")\n hello\n $3 \u003d 0\n (gdb) p $_shell(\"foobar\")\n bash: line 1: foobar: command not found\n $4 \u003d 127\n (gdb) help function _shell\n $_shell - execute a shell command and returns the result.\n Usage: $_shell (command)\n Returns the command\u0027s exit code: zero on success, non-zero otherwise.\n (gdb)\n\nNEWS and manual changes included.\n\nApproved-By: Andrew Burgess \u003caburgess@redhat.com\u003e\nApproved-By: Tom Tromey \u003ctom@tromey.com\u003e\nApproved-By: Eli Zaretskii \u003celiz@gnu.org\u003e\nChange-Id: I7e36d451ee6b428cbf41fded415ae2d6b4efaa4e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "8ac82925fee6d3729e27e0bca47fbac1eea45158",
      "old_mode": 33188,
      "old_path": "gdb/NEWS",
      "new_id": "75cd11b204eb89a20667701fcc2fc13c7502c626",
      "new_mode": 33188,
      "new_path": "gdb/NEWS"
    },
    {
      "type": "modify",
      "old_id": "871785d88862d7eb9b59831fdc0026cf63d268b6",
      "old_mode": 33188,
      "old_path": "gdb/cli/cli-cmds.c",
      "new_id": "0c680896c917d33409bd88fcd406833e4421f90f",
      "new_mode": 33188,
      "new_path": "gdb/cli/cli-cmds.c"
    },
    {
      "type": "modify",
      "old_id": "38e6925e7d6509808aa1184ce183348628a85667",
      "old_mode": 33188,
      "old_path": "gdb/doc/gdb.texinfo",
      "new_id": "bbb39e73c0285da5aabb1c21b7dd12ba335c2af1",
      "new_mode": 33188,
      "new_path": "gdb/doc/gdb.texinfo"
    },
    {
      "type": "modify",
      "old_id": "d0789a644019e498ea7a06d284c02aa3feb84b31",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/default.exp",
      "new_id": "7e73db0576a729fd277d79c56f2a9df8cb064ebc",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/default.exp"
    },
    {
      "type": "modify",
      "old_id": "31cdcb41af5e9c0fe5d92b7b08475a42513e0a65",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/shell.exp",
      "new_id": "ba1691ea2b0c01d060e90d5c371691d7dbc4b033",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/shell.exp"
    }
  ]
}
