[11/11] gdb, remote: implement always_non_stop_p for remote target

Message ID 20260518183316.127043-12-mohamed.bouhaouel@intel.com
State New
Headers
Series Enable non-stop mode by default for remote targets |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Bouhaouel, Mohamed May 18, 2026, 6:33 p.m. UTC
  From: "Bouhaouel, Mohamed" <mohamed.bouhaouel@intel.com>

Enable remote targets to natively operate in non-stop mode when they
announce QNonStop packet support.  This changes the default setting of
'maint set target-non-stop auto' from 'off' to 'on' for remote targets,
aligning with the Linux native target.
---
 gdb/remote.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Patch

diff --git a/gdb/remote.c b/gdb/remote.c
index 92fe518c6de..ecddb9c587d 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1442,6 +1442,8 @@  class remote_target : public process_stratum_target
 
   void check_binary_download (CORE_ADDR addr);
 
+  bool always_non_stop_p () override;
+
   target_xfer_status remote_write_bytes_aux (const char *header,
 					     CORE_ADDR memaddr,
 					     const gdb_byte *myaddr,
@@ -9877,6 +9879,16 @@  remote_target::check_binary_download (CORE_ADDR addr)
     }
 }
 
+/* Determine whether the remote target natively operates in non-stop mode.
+   Returns true if the target announced QNonStop support for asynchronous
+   execution and stop notifications.  */
+
+bool
+remote_target::always_non_stop_p ()
+{
+  return m_features.packet_support (PACKET_QNonStop) == PACKET_ENABLE;
+}
+
 /* Helper function to resize the payload in order to try to get a good
    alignment.  We try to write an amount of data such that the next write will
    start on an address aligned on REMOTE_ALIGN_WRITES.  */