Skip to content

Commit

Permalink
target_is_non_stop_p and sync targets
Browse files Browse the repository at this point in the history
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
  • Loading branch information
palves committed Mar 26, 2021
1 parent bab287c commit e5b9b39
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions gdb/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2021-03-26 Pedro Alves <[email protected]>

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

2021-03-26 Tom Tromey <[email protected]>

* dwarf2/read.c (dwarf2_read_debug_names)
Expand Down
9 changes: 5 additions & 4 deletions gdb/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit e5b9b39

Please sign in to comment.