)]}'
{
  "commit": "032d23a6db097840b7969867df0e2ba035f03f6f",
  "tree": "134add30a5e3b11f5fed90c3e8b229f1fcbe62b6",
  "parents": [
    "fd09caf44f193fb4359376b27904bad0a16ca594"
  ],
  "author": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Thu Feb 29 21:29:34 2024 +0100"
  },
  "committer": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Thu Feb 29 21:29:34 2024 +0100"
  },
  "message": "[gdb/dap] Fix stray KeyboardInterrupt after cancel\n\nWhen running test-case gdb.dap/pause.exp 100 times in a loop, it passes\n100/100.\n\nBut if we remove the two \"sleep 0.2\" from the test-case, we run into\n(copied from dap.log and edited for readability):\n...\nTraceback (most recent call last):\n  File \"startup.py\", line 251, in message\n    def message():\n\nKeyboardInterrupt\nQuit\n...\n\nThis happens as follows.\n\nCancellationHandler.cancel calls gdb.interrupt to cancel a request in flight.\n\nThe idea is that this interrupt triggers while in fn here in message (a nested\nfunction of send_gdb_with_response):\n...\n    def message():\n        try:\n            val \u003d fn()\n            result_q.put(val)\n        except (Exception, KeyboardInterrupt) as e:\n            result_q.put(e)\n...\nbut instead it triggers outside the try/except.\n\nFix this by:\n- in CancellationHandler, renaming variable in_flight to in_flight_dap_thread,\n  and adding a variable in_flight_gdb_thread to be able to distinguish when\n  a request is in flight in the dap thread or the gdb thread.\n- adding a wrapper Cancellable to to deal with cancelling the wrapped\n  event\n- using Cancellable in send_gdb and send_gdb_with_response to wrap the posted\n  event\n- in CancellationHandler.cancel, only call gdb.interrupt if\n  req \u003d\u003d self.in_flight_gdb_thread.\n\nThis makes the test-case pass 100/100, also when adding the extra stressor of\n\"taskset -c 0\", which makes the fail more likely without the patch.\n\nTested on aarch64-linux.\n\nApproved-By: Tom Tromey \u003ctom@tromey.com\u003e\n\nPR dap/31275\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id\u003d31275\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "fe1f8bbd4281fe75b43415eef63b77ae546d739d",
      "old_mode": 33188,
      "old_path": "gdb/python/lib/gdb/dap/server.py",
      "new_id": "cba5a308ff12371753d88e268979cacee2bdb53d",
      "new_mode": 33188,
      "new_path": "gdb/python/lib/gdb/dap/server.py"
    }
  ]
}
