Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Khoo Yit Phang <khooyp@cs.umd.edu>
To: Tom Tromey <tromey@redhat.com>
Cc: Khoo Yit Phang <khooyp@cs.umd.edu>,
	Kevin Pouget <kevin.pouget@gmail.com>,
	gdb-patches@sourceware.org
Subject: Re: Make the "python" command resemble the standard Python interpreter
Date: Wed, 11 Jan 2012 22:22:00 -0000	[thread overview]
Message-ID: <F015DE9E-D577-4421-B7E9-9423BBEC2BF0@cs.umd.edu> (raw)
In-Reply-To: <m3k44y3p1s.fsf@fleche.redhat.com>

Hi,

On Jan 11, 2012, at 4:30 PM, Tom Tromey wrote:

>>>>>> "Yit" == Khoo Yit Phang <khooyp@cs.umd.edu> writes:
> 
> Yit> Attached is a new patch that uses another way to disable the readline
> Yit> module, which works with pdb.set_trace(). However, readline support
> Yit> still doesn't work with pdb. The reason is because pdb uses raw_input,
> Yit> which in turn uses sys.stdin/sys.stdout to determine whether to use
> Yit> readline, but GDB replaces sys.stdin/sys.stdout with it's own
> Yit> file-like objects that isn't recognized as a tty by Python.
> 
> This sounds like http://sourceware.org/bugzilla/show_bug.cgi?id=12150
> Maybe we should try to fix that instead?

Yes, it's related, if I understand correctly, sys.stdout/sys.stderr are overridden the way they are so that GDB can capture/filter the output. Another solution, besides overriding raw_input/input, would be to point sys.stdout/sys.stderr to a PTY, though I'm not sure what the trade-offs are.

> Yit> Making Python's readline module work under GDB is not possible, since
> Yit> it re-initializes libreadline and generally assumes that libreadline
> Yit> is completely under Python's control (and libreadline itself has no
> Yit> support for nesting/reentrancy).
> 
> The initialization shouldn't be a problem.
> 
> Calling rl_initialize multiple times is ok -- readline() itself calls
> it.

However, other configuration cannot be set repeatedly, e.g., rl_readline_name, rl_completion_*, various rl_*_hook, keybindings, and so on.

> I don't know about the reentrancy though.  Also, IIRC, gdb uses the
> unusual async interface.  Maybe that raises some issues.

That may explain another issue I've seen where inputs are delayed by one keystroke.

Yit
January 11, 2011


  reply	other threads:[~2012-01-11 21:58 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  0:31 Khoo Yit Phang
2012-01-11  4:06 ` Joel Brobecker
2012-01-11 10:43 ` Kevin Pouget
2012-01-11 10:59   ` Joel Brobecker
2012-01-11 16:04   ` Khoo Yit Phang
2012-01-11 17:48     ` Khoo Yit Phang
2012-01-11 18:48     ` Kevin Pouget
2012-01-11 19:04       ` Khoo Yit Phang
2012-01-11 19:11         ` Kevin Pouget
2012-01-11 21:06           ` Khoo Yit Phang
2012-01-11 21:33             ` Tom Tromey
2012-01-11 22:22               ` Khoo Yit Phang [this message]
2012-01-20 21:25                 ` Tom Tromey
2012-01-20 21:31             ` Tom Tromey
2012-01-22 16:42               ` Khoo Yit Phang
2012-01-11 20:56 ` Tom Tromey
2012-01-11 21:30   ` Khoo Yit Phang
2012-01-11 21:41     ` Tom Tromey
2012-01-12  3:07   ` Khoo Yit Phang
2012-01-13 14:09   ` Phil Muldoon
2012-01-13 21:39     ` Khoo Yit Phang
2012-01-12 16:48 ` Doug Evans
2012-01-12 16:52   ` Khoo Yit Phang
2012-01-12 16:55   ` Paul_Koning
2012-01-12 17:24     ` Joel Brobecker
2012-01-12 17:30     ` Doug Evans
2012-01-12 17:38       ` Paul_Koning
2012-01-12 17:46         ` Doug Evans
2012-01-12 17:48           ` Doug Evans
2012-01-12 17:51             ` Paul_Koning
2012-01-12 18:06               ` Doug Evans
     [not found]                 ` <CADPb22T1ZmfiGeF9g-QZN6pCTBHwT5ByD9ddX_Dhxe4URvTAhw@mail.gmail.com>
2012-01-12 18:21                   ` Khoo Yit Phang
2012-01-12 18:36                     ` Doug Evans
2012-01-12 18:48                       ` Khoo Yit Phang
2012-01-12 21:22                         ` Doug Evans
2012-01-12 18:30                 ` Doug Evans
2012-01-21  1:56           ` Tom Tromey
2012-01-22 16:57             ` Khoo Yit Phang
2012-01-23 22:17               ` Doug Evans
2012-01-24 17:36                 ` Tom Tromey
2012-01-26 18:28                   ` Doug Evans
2012-01-30  6:50                     ` Khoo Yit Phang
2012-01-30 17:25                       ` Doug Evans
2012-01-30 19:57                         ` Doug Evans
2012-02-06 20:08                           ` Doug Evans
2012-02-06 20:13                             ` Paul_Koning
2012-02-06 20:30                               ` Khoo Yit Phang
2012-02-06 20:34                               ` Doug Evans
2012-02-06 20:59                                 ` Paul_Koning
2012-02-06 21:54                           ` Tom Tromey

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=F015DE9E-D577-4421-B7E9-9423BBEC2BF0@cs.umd.edu \
    --to=khooyp@cs.umd.edu \
    --cc=gdb-patches@sourceware.org \
    --cc=kevin.pouget@gmail.com \
    --cc=tromey@redhat.com \
    /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