This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb and binutils branch gdb-7.8-branch updated. 1fe2833b6dd03602ba86aa334e81466ea9abe66a


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, gdb-7.8-branch has been updated
       via  1fe2833b6dd03602ba86aa334e81466ea9abe66a (commit)
      from  0318afefeff53becc1e3e738793ecdb6653629f4 (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=1fe2833b6dd03602ba86aa334e81466ea9abe66a

commit 1fe2833b6dd03602ba86aa334e81466ea9abe66a
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Jul 9 17:52:58 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]