public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/17372] python hangs when displaying help()
Date: Wed, 14 Jan 2015 12:38:00 -0000	[thread overview]
Message-ID: <bug-17372-4717-HWMyVdNbdw@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-17372-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=17372

--- Comment #9 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pedro Alves <palves@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6c400b59d574782afdb26eb6c021f28c31bb9f1c

commit 6c400b59d574782afdb26eb6c021f28c31bb9f1c
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Jan 14 11:51:06 2015 +0000

    PR cli/17828: -batch -ex r breaks terminal

    Commit d3d4baed (PR python/17372 - Python hangs when displaying
    help()) had the side effect of causing 'gdb -batch' to leave the
    terminal in the wrong state if the program was run.  E.g,.

     $ echo 'main(){*(int*)0=0;}' | gcc -x c -; ./gdb/gdb -batch -ex r ./a.out
     Program received signal SIGSEGV, Segmentation fault.
     0x00000000004004ff in main ()
     $

    If you start typing the next command, seemingly nothing happens - GDB
    left the terminal with echo disabled.

    The issue is that that "r" ends up in fetch_inferior_event, which
    calls reinstall_readline_callback_handler_cleanup, which causes
    readline to prep the terminal (raw, echo disabled).  But "-batch"
    causes GDB to exit before the top level event loop is first started,
    and then nothing de-preps the terminal.

    The reinstall_readline_callback_handler_cleanup function's intro
    comment mentions:

     "Need to do this as we go back to the event loop, ready to process
     further input."

    but the implementation forgets the case of when the interpreter is
    sync, which indicates we won't return to the event loop yet, or as in
    the case of -batch, we have not started it yet.

    The fix is to not install the readline callback in that case.

    For the test, in this case, checking that command echo still works is
    sufficient.  Comparing stty output before/after running GDB is even
    better.  Because stty may not be available, the test tries both ways.
    In any case, since expect's spawn (what we use to start gdb) creates a
    new pseudo tty, another expect spawn or tcl exec after GDB exits would
    not see the wrong terminal settings.  So instead, the test spawns a
    shell and runs stty and GDB in it.

    Tested on x86_64 Fedora 20.

    gdb/
    2015-01-14  Pedro Alves  <palves@redhat.com>

        PR cli/17828
        * infrun.c (reinstall_readline_callback_handler_cleanup): Don't
        reinstall if the interpreter is sync.

    gdb/testsuite/
    2015-01-14  Pedro Alves  <palves@redhat.com>

        PR cli/17828
        * gdb.base/batch-preserve-term-settings.c: New file.
        * gdb.base/batch-preserve-term-settings.exp: New file.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


  parent reply	other threads:[~2015-01-14 12:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11  9:02 [Bug python/17372] New: " serge.chatroux at st dot com
2014-09-11  9:03 ` [Bug python/17372] " serge.chatroux at st dot com
2014-09-13  0:05 ` sergiodj at redhat dot com
2014-10-23 11:58 ` palves at redhat dot com
2014-10-24 12:06 ` palves at redhat dot com
2014-10-29 17:33 ` cvs-commit at gcc dot gnu.org
2014-10-29 18:15 ` cvs-commit at gcc dot gnu.org
2014-10-29 18:33 ` palves at redhat dot com
2014-10-29 19:48 ` cvs-commit at gcc dot gnu.org
2014-12-25  0:46 ` cvs-commit at gcc dot gnu.org
2015-01-14 12:38 ` cvs-commit at gcc dot gnu.org [this message]
2015-01-14 12:43 ` cvs-commit at gcc dot gnu.org
2015-01-14 13:18 ` cvs-commit at gcc dot gnu.org
2021-10-21  6:51 ` bap.fayol at gmail dot com
2021-11-09  8:33 ` johnsjvi95 at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-17372-4717-HWMyVdNbdw@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).