From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9513 invoked by alias); 13 Feb 2009 11:06:16 -0000 Received: (qmail 9504 invoked by uid 22791); 13 Feb 2009 11:06:16 -0000 X-SWARE-Spam-Status: No, hits=1.0 required=5.0 tests=AWL,BAYES_00,BOTNET,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout1.012.net.il (HELO mtaout1.012.net.il) (84.95.2.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Feb 2009 11:06:07 +0000 Received: from conversion-daemon.i-mtaout1.012.net.il by i-mtaout1.012.net.il (HyperSendmail v2007.08) id <0KF000G0044V6Z00@i-mtaout1.012.net.il> for gdb-patches@sourceware.org; Fri, 13 Feb 2009 13:06:33 +0200 (IST) Received: from HOME-C4E4A596F7 ([84.229.24.112]) by i-mtaout1.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KF0000H346VJC60@i-mtaout1.012.net.il>; Fri, 13 Feb 2009 13:06:32 +0200 (IST) Date: Fri, 13 Feb 2009 15:23:00 -0000 From: Eli Zaretskii Subject: Re: RFC: add ability to "source" Python code In-reply-to: <20090213022246.GA5401@adacore.com> To: Joel Brobecker Cc: tromey@redhat.com, bauerman@br.ibm.com, drow@false.org, pedro@codesourcery.com, gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: References: <20090211060911.GB4225@adacore.com> <20090211203921.GC13021@adacore.com> <20090211220118.GE13021@adacore.com> <20090212062654.GG13021@adacore.com> <20090213022246.GA5401@adacore.com> 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: 2009-02/txt/msg00302.txt.bz2 > Date: Thu, 12 Feb 2009 18:22:46 -0800 > From: Joel Brobecker > Cc: tromey@redhat.com, bauerman@br.ibm.com, drow@false.org, > pedro@codesourcery.com, gdb-patches@sourceware.org > > > > Anyway, how about a compromise, then, and require the -p switch to > > > source python scripts? The incompatibility is that > > > > > > (gdb) source -p foo > > > > > > would no longer work for file "-p foo". I think that's an acceptable > > > "incompatibilty". Would you agree? > > > > This is a misunderstanding: I didn't mind the -p switch, I mind the > > fact that it throws an error if Python is not compiled in. Eliminate > > the error, and you have me on board. > > Cool! So, just to make sure I understand what you're saying, you would > agree to the following change: > > Add a -p switch to the "source" command that signifies that we're sourcing > a python script instead of a GDB script. We drop the part where we're > using the filename extension to guess the file language, thus preserving > the current behavior. Yes. I would even agree to retaining the language guesswork by file-name extension, provided that (a) there's a user option to turn that on and off, and (b) that option is off and stays off when Python is not compiled in. > Finally, what should we do if trying to source a python script with > a debugger that does not have python linked in? Treat the -p switch > as part of the script filename? (I would find this really odd) Ideally, it should work as it does today, but if that's too hard to implement, how about simply ignoring -p in that case? That is, let "source -p foo" behave like "source foo". On the slim chance that this somewhat heated discussion was due to a similar misunderstanding, I dare to quote what I originally wrote: However, I don't think I like the idea of GDB barfing if Python support is not compiled in. I think it should simply try to interpret the file as GDB scripting commands. and To clarify, I think "source" without Python compiled should behave exactly as it did before this patch: treat foo.py as any other file name and treat -p as it does today (i.e. source "-p foo.gdb" if it exists). Now I add to this the suggestion to have a user variable as described above. Hopefully, somewhere in between we will be able to find a compromise that won't cause any of us to storm out of the premises ;-)