]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
target_is_non_stop_p and sync targets
authorPedro Alves <pedro@palves.net>
Mon, 22 Feb 2021 00:18:10 +0000 (00:18 +0000)
committerPedro Alves <pedro@palves.net>
Fri, 26 Mar 2021 15:57:25 +0000 (15:57 +0000)
gdb.base/maint-target-async-off.exp fails if you test against
gdbserver with "maint set target-non-stop on" forced.

  (gdb) run
  Starting program: build/gdb/testsuite/outputs/gdb.base/maint-target-async-off/maint-target-async-off

  Breakpoint 1, main () at src/gdb/testsuite/gdb.base/maint-target-async-off.c:21
  21        return 0;
  (gdb) FAIL: gdb.base/maint-target-async-off.exp: continue until exit (timeout)

Above, GDB just stopped listening to stdin.

Basically, GDB assumes that a target working in non-stop mode
operation also supports async mode; it's a requirement.  GDB
misbehaves badly otherwise, and even hits failed assertions.

Fix this by making target_is_non_stop_p return false if async is off.

gdb/ChangeLog:

* target.c (target_always_non_stop_p): Also check whether the
target can async.

Change-Id: I7e52e1061396a5b9b02ada462f68a14b76d68974

gdb/ChangeLog
gdb/target.c

index 8e7b92087aab59ab05b570253b6904300d1b48a8..7f60d3c01ab85cace737ef5fa74ca7fc603e5a17 100644 (file)
@@ -1,3 +1,8 @@
+2021-03-26  Pedro Alves  <pedro@palves.net>
+
+       * target.c (target_always_non_stop_p): Also check whether the
+       target can async.
+
 2021-03-26  Tom Tromey  <tom@tromey.com>
 
        * dwarf2/read.c (dwarf2_read_debug_names)
index 3653a7a98f805091fc7fedbc087b60a4ca88bc9e..51832c52b6aff6ae8f0498ea16e3956b83168564 100644 (file)
@@ -4370,10 +4370,11 @@ target_always_non_stop_p (void)
 bool
 target_is_non_stop_p ()
 {
-  return (non_stop
-         || target_non_stop_enabled == AUTO_BOOLEAN_TRUE
-         || (target_non_stop_enabled == AUTO_BOOLEAN_AUTO
-             && target_always_non_stop_p ()));
+  return ((non_stop
+          || target_non_stop_enabled == AUTO_BOOLEAN_TRUE
+          || (target_non_stop_enabled == AUTO_BOOLEAN_AUTO
+              && target_always_non_stop_p ()))
+         && target_can_async_p ());
 }
 
 /* See target.h.  */