This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
gdb and binutils branch master updated. 7180e04a36d812bbea2c280f2db33a7e8ce6b07b
- From: palves at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: 9 Jul 2014 16:52:05 -0000
- Subject: gdb and binutils branch master updated. 7180e04a36d812bbea2c280f2db33a7e8ce6b07b
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".
The branch, master has been updated
via 7180e04a36d812bbea2c280f2db33a7e8ce6b07b (commit)
from 9a9a76082919371f4ceb571f6c9892325b80a2e0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7180e04a36d812bbea2c280f2db33a7e8ce6b07b
commit 7180e04a36d812bbea2c280f2db33a7e8ce6b07b
Author: Pedro Alves <palves@redhat.com>
Date: Wed Jul 9 15:59:02 2014 +0100
Fix "attach" command vs user input race
On async targets, a synchronous attach is done like this:
#1 - target_attach is called (PTRACE_ATTACH is issued)
#2 - a continuation is installed
#3 - we go back to the event loop
#4 - target reports stop (SIGSTOP), event loop wakes up, and
attach continuation is called
#5 - among other things, the continuation calls
target_terminal_inferior, which removes stdin from the event
loop
Note that in #3, GDB is still processing user input. If the user is
fast enough, e.g., with something like:
echo -e "attach PID\nset xxx=1" | gdb
... then the "set" command is processed before the attach completes.
We get worse behavior even, if input is a tty and therefore
readline/editing is enabled, with e.g.,:
(gdb) attach PID\nset xxx=1
we then crash readline/gdb, with:
Attaching to program: attach-wait-input, process 14537
readline: readline_callback_read_char() called with no handler!
Aborted
$
Fix this by calling target_terminal_inferior before #3 above.
The test covers both scenarios by running with editing/readline forced
to both on and off.
gdb/
2014-07-09 Pedro Alves <palves@redhat.com>
* infcmd.c (attach_command_post_wait): Don't call
target_terminal_inferior here.
(attach_command): Call it here instead.
gdb/testsuite/
2014-07-09 Pedro Alves <palves@redhat.com>
* gdb.base/attach-wait-input.exp: New file.
* gdb.base/attach-wait-input.c: New file.
-----------------------------------------------------------------------
Summary of changes:
gdb/ChangeLog | 6 ++
gdb/infcmd.c | 19 ++++-
gdb/testsuite/ChangeLog | 5 +
gdb/testsuite/gdb.base/attach-wait-input.c | 40 +++++++++
gdb/testsuite/gdb.base/attach-wait-input.exp | 119 ++++++++++++++++++++++++++
5 files changed, 186 insertions(+), 3 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/attach-wait-input.c
create mode 100644 gdb/testsuite/gdb.base/attach-wait-input.exp
hooks/post-receive
--
gdb and binutils