From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1966 invoked by alias); 6 Feb 2012 20:08:57 -0000 Received: (qmail 1955 invoked by uid 22791); 6 Feb 2012 20:08:56 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-vw0-f41.google.com (HELO mail-vw0-f41.google.com) (209.85.212.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Feb 2012 20:08:43 +0000 Received: by vbip1 with SMTP id p1so5035685vbi.0 for ; Mon, 06 Feb 2012 12:08:42 -0800 (PST) Received: by 10.52.93.74 with SMTP id cs10mr9336568vdb.42.1328558922873; Mon, 06 Feb 2012 12:08:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.52.93.74 with SMTP id cs10mr9336555vdb.42.1328558922766; Mon, 06 Feb 2012 12:08:42 -0800 (PST) Received: by 10.220.162.7 with HTTP; Mon, 6 Feb 2012 12:08:41 -0800 (PST) In-Reply-To: References: <09787EF419216C41A903FD14EE5506DD030F1EB39B@AUSX7MCPC103.AMER.DELL.COM> <09787EF419216C41A903FD14EE5506DD030F1EB45D@AUSX7MCPC103.AMER.DELL.COM> Date: Mon, 06 Feb 2012 20:08:00 -0000 Message-ID: Subject: Re: Make the "python" command resemble the standard Python interpreter From: Doug Evans To: Khoo Yit Phang Cc: Tom Tromey , Paul_Koning@dell.com, gdb-patches@sourceware.org X-System-Of-Record: true Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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-02/txt/msg00064.txt.bz2 On Mon, Jan 30, 2012 at 9:25 AM, Doug Evans wrote: > On Mon, Jan 30, 2012 at 9:18 AM, Doug Evans wrote: >> Plus, with some playing around I found this: >> >> --- foo.gdb - snip --- >> python >> if 0 =3D=3D 1: >> =A0print "foo" >> print "bar" >> end >> --- snip --- >> >> (gdb) source foo.gdb >> bar >> (gdb) >> >> But cut-n-paste that script into gdb and I get this: >> >> (gdb) python >> if 0 =3D=3D 1: >> =A0print "foo" >> print "bar" >> end >>>>> ... ... =A0 File "", line 3 >> =A0 =A0print "bar" >> =A0 =A0 =A0 =A0^ >> SyntaxError: invalid syntax >>>>> >> (gdb) >> >> [For reference sake, here's how I cut-n-pasted it in emacs: >> C-x C-f foo.gdb RET C-space C-x ] C-b M-w C-x b RET C-y RET >> I hope I transcribed that right.] >> >> Python's repl expects a blank line to end the block. >> I don't know if there's a way to work around this. =A0Maybe there is. >> So now I'm even less comfortable. > > btw, that's with the latest python-interactive script (that I could > find) applied (+ the sigint patch too). > > For grin's sake, there's another example: > > --- snip --- > python > if 0 =3D=3D 1: > =A0print "foo" > end > --- > > If I cut-n-paste that into gdb the "end" terminates the "if" block > (heh, didn't expect that :-)), and afterwards I'm still in python. > Maybe this can be fixed too. btw, in an effort to keep things moving along, to repeat something I mentioned earlier, If you, for example, add a new command, say, "python-block" ('tis the best I could come up with :-() that always behaved like python...end in scripts, then I think that would be ok: Users that want the existing script-like behaviour can switch to and use it instead of "python". IOW, "python-block" always behaves like the existing "python" command without arguments. E.g., python-block if 0 =3D=3D 1: print "foo" end