From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21360 invoked by alias); 22 Jan 2012 16:42:45 -0000 Received: (qmail 21340 invoked by uid 22791); 22 Jan 2012 16:42:43 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,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; Sun, 22 Jan 2012 16:42:31 +0000 Received: from [10.61.40.39] (unknown [70.42.157.21]) (Authenticated sender: khooyp) by bacon.cs.umd.edu (Postfix) with ESMTPSA id 4C5D5B402C3; Sun, 22 Jan 2012 11:42:22 -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: Sun, 22 Jan 2012 16:57:00 -0000 Cc: Khoo Yit Phang , Doug Evans , Paul_Koning@dell.com, gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <09787EF419216C41A903FD14EE5506DD030F1EB39B@AUSX7MCPC103.AMER.DELL.COM> <09787EF419216C41A903FD14EE5506DD030F1EB45D@AUSX7MCPC103.AMER.DELL.COM> To: Tom Tromey X-CSD-MailScanner-ID: 4C5D5B402C3.A8645 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: 1327855349.64738@s5PCHRP3Bys28cz1c35mbQ 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/msg00756.txt.bz2 Hi, On Jan 20, 2012, at 4:22 PM, Tom Tromey wrote: >>>>>> "Doug" =3D=3D Doug Evans writes: >=20 > Paul> Yes, but I think the benefits outweigh the small imcompatibility. >=20 > Doug> Yes and no. > Doug> - I may want a script that invokes python interactively. > Doug> - How do I write a gdb macro that invokes the python repl? >=20 > I think: >=20 > (gdb) python gdb.execute('python', from_tty =3D True) >=20 > This is sort of weird, but I think it is ok to require a weird command > to fill an unusual need. To summarize the various proposals: 1. Make "python" start an interactive Python shell only, and introduce anot= her command (say, "python-script") for non-interactive scripts. 2. Make "python" take a flag (say, "python -") that forces an interactive P= ython shell regardless of from_tty. 3. Start an interactive Python shell from a user-defined command by "python= gdb.execute('python', from_tty =3D True)". Personally, I prefer 2 or 3 since they retain compatibility with existing s= cripts. Yit January 22, 2012