)]}'
{
  "commit": "ae2f226dc83648232ce25ce799c865857395412e",
  "tree": "0fa11926ca1787f41b8f3c96d1ceda7aba729647",
  "parents": [
    "edeff39baffb07b68e8790980dbee20965123621"
  ],
  "author": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Sat May 17 10:54:50 2025 +0100"
  },
  "committer": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Thu Apr 30 18:37:32 2026 +0100"
  },
  "message": "Windows gdb: Add non-stop support\n\nThis patch adds non-stop support to the native Windows target.\n\nThis is made possible by the ContinueDebugEvent DBG_REPLY_LATER flag:\n\nhttps://learn.microsoft.com/en-us/windows/win32/api/debugapi/nf-debugapi-continuedebugevent\n\n  Supported in Windows 10, version 1507 or above, this flag causes\n  dwThreadId to replay the existing breaking event after the target\n  continues. By calling the SuspendThread API against dwThreadId, a\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  debugger can resume other threads in the process and later return to\n  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  the breaking.\n  ^^^^^^^^^^^^\n\nThe patch adds a new comment section in gdb/windows-nat.c providing an\noverall picture of how all-stop / non-stop work.\n\nWithout DBG_REPLY_LATER, if we SuspendThread the thread, and then\nimmediately ContinueDebugThread(DBG_CONTINUE) before getting back to\nthe prompt, we could still have non-stop mode working, however, then\nusers wouldn\u0027t have a chance to decide whether to pass the signal to\nthe inferior the next time they resume the program, as that is done by\npassing DBG_EXCEPTION_NOT_HANDLED to ContinueDebugEvent, and that has\nalready been called.\n\nThe patch teaches the Windows native backend to use that\nDBG_REPLY_LATER flag, and also adds support for target_stop, so the\ncore can pause threads at its discretion.  This pausing does not use\nthe same mechanisms used in windows_nat_target::interrupt, as that\ninjects a new thread in the inferior.  Instead, for each thread the\ncore wants paused, it uses SuspendThread, and enqueues a pending\nGDB_SIGNAL_0 stop on the thread.\n\nSince DBG_REPLY_LATER only exists on Windows 10 and later, we only\nenable non-stop mode on Windows 10 and later.\n\nThere is no displaced stepping support, but that\u0027s \"just\" a missed\noptimization to be done later.\n\nCygwin signals handling was a major headache, but I managed to get it\nworking.  See the \"Cygwin signals\" description section I added at the\ntop of windows-nat.c.\n\nAnother interesting bit, is that the use DBG_REPLY_LATER caused one\nproblem with detach.  The Windows kernel re-raises any exception\npreviously intercepted and deferred with DBG_REPLY_LATER in the\ninferior after we detach.  We need to flush those events, and suppress\nthose which aren\u0027t meant to be seen by the inferior (e.g.,\nbreakpoints, single-steps, any with matching \"handle SIG nopass\",\netc.), otherwise the inferior dies immediately after the detach, due\nto an unhandled exception.\n\nAcked-By: Tom Tromey \u003ctom@tromey.com\u003e\nChange-Id: Id71aef461c43c244120635b5bedc638fe77c31fb\ncommit-id:bbf38a26\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2b0828057080675ec8d503a07dda1b15546a695b",
      "old_mode": 33188,
      "old_path": "gdb/aarch64-windows-nat.c",
      "new_id": "e6b596a38cb1a3baae94201b5c6a400910040a97",
      "new_mode": 33188,
      "new_path": "gdb/aarch64-windows-nat.c"
    },
    {
      "type": "modify",
      "old_id": "72576222b8d472d16791599bbb07a03c5b49dbb0",
      "old_mode": 33188,
      "old_path": "gdb/nat/windows-nat.c",
      "new_id": "b093acda342b4cb4bc1fd12f71a2718fcbb566a2",
      "new_mode": 33188,
      "new_path": "gdb/nat/windows-nat.c"
    },
    {
      "type": "modify",
      "old_id": "364a01c572490dfd1f02cc5ed86cedc590dddf65",
      "old_mode": 33188,
      "old_path": "gdb/nat/windows-nat.h",
      "new_id": "f61eab766ac58e1b8f9f985a35f73fc489e53ffb",
      "new_mode": 33188,
      "new_path": "gdb/nat/windows-nat.h"
    },
    {
      "type": "modify",
      "old_id": "67e4d35f96fc63ac7c6a0f8bdc4b0c9a433f5aa7",
      "old_mode": 33188,
      "old_path": "gdb/windows-nat.c",
      "new_id": "d56510c23f6c4e657d8097c7caa8f6dea172675c",
      "new_mode": 33188,
      "new_path": "gdb/windows-nat.c"
    },
    {
      "type": "modify",
      "old_id": "d63ef6e7b338725d50078d2861c48ace19f0954e",
      "old_mode": 33188,
      "old_path": "gdb/windows-nat.h",
      "new_id": "7ce71690e201895759e1e9b7807c395e8af21aed",
      "new_mode": 33188,
      "new_path": "gdb/windows-nat.h"
    },
    {
      "type": "modify",
      "old_id": "ccabe80f9b4d5902811dff6555492a6d5bea4103",
      "old_mode": 33188,
      "old_path": "gdb/x86-windows-nat.c",
      "new_id": "8ad9d3bedea5b4616543c0b277ff26388ca874bb",
      "new_mode": 33188,
      "new_path": "gdb/x86-windows-nat.c"
    },
    {
      "type": "modify",
      "old_id": "8d24826d05c8b98ad9dfc2611b786b808f002d27",
      "old_mode": 33188,
      "old_path": "gdbserver/win32-low.cc",
      "new_id": "469ff32f0709055a78a66cbc25e25e50829daf72",
      "new_mode": 33188,
      "new_path": "gdbserver/win32-low.cc"
    },
    {
      "type": "modify",
      "old_id": "ff680492756111ae00227910d2e6972cb1a61f34",
      "old_mode": 33188,
      "old_path": "gdbserver/win32-low.h",
      "new_id": "439adb84bc256585792604c3664bedd13a7c6331",
      "new_mode": 33188,
      "new_path": "gdbserver/win32-low.h"
    }
  ]
}
