[PATCH 18/18] remote: enable "maint set target-non-stop" by default

Pedro Alves
2015-10-14T15:28:29Z

... on remote targets that support it.

gdb/ChangeLog:
2015-10-14 Pedro Alves <palves@redhat.com>

* remote.c (remote_always_non_stop_p): New function.
(init_remote_ops): Install it as to_always_non_stop_p method.
---
gdb/remote.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/gdb/remote.c b/gdb/remote.c
index c7a01d2..5e88221 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -11598,6 +11598,20 @@ remote_supports_non_stop (struct target_ops *self)
return 1;
}

+/* to_always_non_stop_p implementation. */
+
+static int
+remote_always_non_stop_p (struct target_ops *self)
+{
+ struct remote_state *rs = get_remote_state ();
+
+ /* Only enable if the stub supports the minimum set of optional
+ packets that make AS/NS possible. */
+ return (packet_support (PACKET_QNonStop) == PACKET_ENABLE
+ && packet_support (PACKET_no_resumed) == PACKET_ENABLE
+ && packet_support (PACKET_QThreadEvents) == PACKET_ENABLE);
+}
+
static int
remote_supports_disable_randomization (struct target_ops *self)
{
@@ -12986,6 +13000,7 @@ Specify the serial device it is connected to\n\
remote_ops.to_terminal_inferior = remote_terminal_inferior;
remote_ops.to_terminal_ours = remote_terminal_ours;
remote_ops.to_supports_non_stop = remote_supports_non_stop;
+ remote_ops.to_always_non_stop_p = remote_always_non_stop_p;
remote_ops.to_supports_multi_process = remote_supports_multi_process;
remote_ops.to_supports_disable_randomization
= remote_supports_disable_randomization;
--
1.9.3