From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1001 invoked by alias); 11 Jan 2012 21:58:34 -0000 Received: (qmail 988 invoked by uid 22791); 11 Jan 2012 21:58:33 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,TW_PD,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from router-304.cs.umd.edu (HELO bacon.cs.umd.edu) (128.8.127.145) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jan 2012 21:58:20 +0000 Received: from wireless-206-196-163-53.umd.edu (wireless-206-196-163-53.umd.edu [206.196.163.53]) (Authenticated sender: khooyp) by bacon.cs.umd.edu (Postfix) with ESMTPSA id 9DDBFB411F8; Wed, 11 Jan 2012 16:58:18 -0500 (EST) Subject: Re: Make the "python" command resemble the standard Python interpreter Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Khoo Yit Phang In-Reply-To: Date: Wed, 11 Jan 2012 22:22:00 -0000 Cc: Khoo Yit Phang , Kevin Pouget , gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <94906C8E-C23D-4DA3-989D-DDCCFA20FC35@cs.umd.edu> <48619020-0550-4888-9F05-158DB065252B@cs.umd.edu> <19AA588F-ED95-47C6-A562-6FF30AF22A38@cs.umd.edu> To: Tom Tromey X-CSD-MailScanner-ID: 9DDBFB411F8.ABA55 X-CSD-MailScanner: Found to be clean X-CSD-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-50, required 5, autolearn=not spam, ALL_TRUSTED -50.00) X-CSD-MailScanner-From: khooyp@cs.umd.edu X-CSD-MailScanner-Watermark: 1326923898.78593@+5pnAulroi1vFKTG7rlgVg Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00385.txt.bz2 Hi, On Jan 11, 2012, at 4:30 PM, Tom Tromey wrote: >>>>>> "Yit" =3D=3D Khoo Yit Phang writes: >=20 > 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_inpu= t, > 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. >=20 > This sounds like http://sourceware.org/bugzilla/show_bug.cgi?id=3D12150 > Maybe we should try to fix that instead? Yes, it's related, if I understand correctly, sys.stdout/sys.stderr are ove= rridden 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). >=20 > The initialization shouldn't be a problem. >=20 > Calling rl_initialize multiple times is ok -- readline() itself calls > it. However, other configuration cannot be set repeatedly, e.g., rl_readline_na= me, 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 ke= ystroke. Yit January 11, 2011