)]}'
{
  "commit": "6f4cb31cf24215abefbecaeefec6accb2a95fad4",
  "tree": "df6e1503e387c569f51fe40e5d456761b05cffe4",
  "parents": [
    "d0490f89ad3670e1cdbe06db25f391eb5f9f0d6d"
  ],
  "author": {
    "name": "Simon Marchi",
    "email": "simon.marchi@polymtl.ca",
    "time": "Mon Nov 08 16:42:45 2021 -0500"
  },
  "committer": {
    "name": "Simon Marchi",
    "email": "simon.marchi@polymtl.ca",
    "time": "Mon Nov 08 16:42:45 2021 -0500"
  },
  "message": "gdb: tweak scoped_disable_commit_resumed uses when resuming all threads in non-stop\n\nWhen doing \"continue -a\" in non-stop mode, each thread is individually\nresumed while the commit resumed state is enabled.  This forces the\ntarget to commit each resumption immediately, instead of being able to\nbatch things.\n\nThe reason is that there is no scoped_disable_commit_resumed around the\nloop over threads in continue_1, when \"non_stop \u0026\u0026 all_threads\" is true.\nSince the proceed function is called once for each thread, the\nscoped_disable_commit_resumed in proceed therefore forces commit-resumed\nbetween each thread resumption.  Add the necessary\nscoped_disable_commit_resumed in continue_1 to avoid that.\n\nI looked at the MI side of things, the function exec_continue, and found\nthat it was correct.  There is a similar iteration over threads, and\nthere is a scoped_disable_commit_resumed at the function scope.  This is\nnot wrong, but a bit more than we need.  The branches that just call\ncontinue_1 do not need it, as continue_1 takes care of disabling commit\nresumed.  So, move the scoped_disable_commit_resumed to the inner scope\nwhere we iterate on threads and proceed them individually.\n\nHere\u0027s an example debugging a multi-threaded program attached by\ngdbserver (debug output trimmed for brevity):\n\n    $ ./gdb -nx -q --data-directory\u003ddata-directory -ex \"set non-stop\" -ex \"tar rem :1234\"\n    (gdb) set debug remote\n    (gdb) set debug infrun\n    (gdb) c -a\n    Continuing.\n    [infrun] proceed: enter\n      [infrun] scoped_disable_commit_resumed: reason\u003dproceeding\n      [remote] Sending packet: $vCont;c:p14388.14388#90\n      [infrun] reset: reason\u003dproceeding\n      [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target remote\n      [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target remote\n    [infrun] proceed: exit\n    [infrun] proceed: enter\n      [infrun] scoped_disable_commit_resumed: reason\u003dproceeding\n      [remote] Sending packet: $vCont;c:p14388.1438a#b9\n      [infrun] reset: reason\u003dproceeding\n      [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target remote\n      [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target remote\n    [infrun] proceed: exit\n    ... and so on for each thread ...\n\nNotice how we send one vCont;c for each thread.  With the patch applied, we\nsend a single vCont;c at the end:\n\n    [infrun] scoped_disable_commit_resumed: reason\u003dcontinue all threads in non-stop\n    [infrun] proceed: enter\n      [infrun] scoped_disable_commit_resumed: reason\u003dproceeding\n      [infrun] reset: reason\u003dproceeding\n    [infrun] proceed: exit\n    [infrun] clear_proceed_status_thread: Thread 85790.85792\n    [infrun] proceed: enter\n      [infrun] scoped_disable_commit_resumed: reason\u003dproceeding\n      [infrun] reset: reason\u003dproceeding\n    [infrun] proceed: exit\n    ... proceeding threads individually ...\n    [infrun] reset: reason\u003dcontinue all threads in non-stop\n    [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target remote\n    [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target remote\n    [remote] Sending packet: $vCont;c#a8\n\nChange-Id: I331dd2473c5aa5114f89854196fed2a8fdd122bb\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2c60be38055c58f92da797b613473007ba5e5295",
      "old_mode": 33188,
      "old_path": "gdb/infcmd.c",
      "new_id": "6bbd45618eb2764514daa3719217bfb1d41762ad",
      "new_mode": 33188,
      "new_path": "gdb/infcmd.c"
    },
    {
      "type": "modify",
      "old_id": "44008d1c0a869db70c9639c76d0b5c86afaf5540",
      "old_mode": 33188,
      "old_path": "gdb/mi/mi-main.c",
      "new_id": "e28fae0cc6cf87ef1fc2efe464085af8061f6b89",
      "new_mode": 33188,
      "new_path": "gdb/mi/mi-main.c"
    }
  ]
}
