Linux: make target_is_async_p return false when async is off
authorPedro Alves <palves@redhat.com>
Fri, 23 Jan 2015 11:12:39 +0000 (11:12 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 23 Jan 2015 11:12:39 +0000 (11:12 +0000)
commit198297aafb4f7a9717be8370581b048ae9107c14
tree8570ebf1a6777d3baac44cef0087494bf8288e57
parentbbbbffbbfc3fca35649896d6626ab02581df8037
Linux: make target_is_async_p return false when async is off

linux_nat_is_async_p currently always returns true, even when the
target is _not_ async.  That confuses
gdb_readline_wrapper/gdb_readline_wrapper_cleanup, which
force-disables target-async while the secondary prompt is active.  As
a result, when gdb_readline_wrapper returns, the target is left async,
even through it was sync to begin with.

That can result in weird bugs, like the one the test added by this
commit exposes.

Ref: https://sourceware.org/ml/gdb-patches/2015-01/msg00592.html

gdb/ChangeLog:
2015-01-23  Pedro Alves  <palves@redhat.com>

* linux-nat.c (linux_is_async_p): New macro.
(linux_nat_is_async_p):
(linux_nat_terminal_inferior): Check whether the target can async
instead of whether it is already async.
(linux_nat_terminal_ours): Don't check whether the target is
async.
(linux_async_pipe): Use linux_is_async_p.

gdb/testsuite/ChangeLog:
2015-01-23  Pedro Alves  <palves@redhat.com>

* gdb.threads/continue-pending-after-query.c: New file.
* gdb.threads/continue-pending-after-query.exp: New file.
gdb/ChangeLog
gdb/linux-nat.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.threads/continue-pending-after-query.c [new file with mode: 0644]
gdb/testsuite/gdb.threads/continue-pending-after-query.exp [new file with mode: 0644]