From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13499 invoked by alias); 23 Jan 2012 22:08:01 -0000 Received: (qmail 13443 invoked by uid 22791); 23 Jan 2012 22:08:00 -0000 X-SWARE-Spam-Status: No, hits=-3.0 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-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Jan 2012 22:07:48 +0000 Received: by vcbfl11 with SMTP id fl11so2620245vcb.0 for ; Mon, 23 Jan 2012 14:07:47 -0800 (PST) Received: by 10.52.95.74 with SMTP id di10mr4879384vdb.46.1327356467363; Mon, 23 Jan 2012 14:07:47 -0800 (PST) MIME-Version: 1.0 Received: by 10.52.95.74 with SMTP id di10mr4879375vdb.46.1327356467265; Mon, 23 Jan 2012 14:07:47 -0800 (PST) Received: by 10.220.229.1 with HTTP; Mon, 23 Jan 2012 14:07:47 -0800 (PST) In-Reply-To: References: <09787EF419216C41A903FD14EE5506DD030F1EB39B@AUSX7MCPC103.AMER.DELL.COM> <09787EF419216C41A903FD14EE5506DD030F1EB45D@AUSX7MCPC103.AMER.DELL.COM> Date: Mon, 23 Jan 2012 22:17: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 X-Gm-Message-State: ALoCoQnheM7+XemD/K05Fx7v8wgetIh2vNg073J/I3mCGKNCOoGgD2KUJSA7qWedGfAst4XZopYyk02KRc9SzmKWhbcdq/ilk5tGjRlXyiPoQ9BzJy6uJhQRnMqGJa9lcOGArdghuw5pfD0a7KsyN5srCCljmZbENg== Content-Type: text/plain; charset=ISO-8859-1 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-01/txt/msg00797.txt.bz2 On Sun, Jan 22, 2012 at 8:42 AM, Khoo Yit Phang wrote: > Hi, > > On Jan 20, 2012, at 4:22 PM, Tom Tromey wrote: > >>>>>>> "Doug" == Doug Evans writes: >> >> Paul> Yes, but I think the benefits outweigh the small imcompatibility. >> >> 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? >> >> I think: >> >> (gdb) python gdb.execute('python', from_tty = True) >> >> 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 another command (say, "python-script") for non-interactive scripts. > 2. Make "python" take a flag (say, "python -") that forces an interactive Python shell regardless of from_tty. > 3. Start an interactive Python shell from a user-defined command by "python gdb.execute('python', from_tty = True)". > > Personally, I prefer 2 or 3 since they retain compatibility with existing scripts. Hi. I'm not that comfortable with having the python command having such varying behaviours (especially based on the value of from_tty). OTOH, if you want to treat it as "a lost cause", an "experiment gone wrong", or whatever :-), and add commands that don't have that problem, then I might be ok with it.