This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: add ability to "source" Python code
On Tuesday 10 February 2009 01:27:32, Tom Tromey wrote:
> >>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
>
> Pedro> Could you explain for the archives why this is better than having
> Pedro> the script itself tell GDB that it's running python? ?Either
> Pedro> through something similar to a shebang, or starting the script with
> Pedro> "python" (does that work?) ? ?I think you've discussed this before,
> Pedro> what were the limitations you found?
>
> I think you may be thinking of invoking a python script using
> "#!.../gdb -something". ?This patch does not cover that case. ?That is
> a separate patch, which I haven't submitted.
I was thinking of the case of sourcing a python script from
inside gdb, not that.
>
> Anyway, I think having "source" look at a #! line would not be very
> helpful. ?Most Python source files do not start with this.
>
OK then.
> Yes, you can write:
>
> ? python
> ? blah blah blah
> ? end
>
> in a file and then source that. ?IME, this is not always convenient.
Ah, I though I had heard mention that that this worked. If experience
claims this isn't rightish, so be it.
> In practice, though, I find I use the .py extension feature a lot more
> than "-p". ?I can remove the "-p" feature if that will make you and
> Eli and Doug happy.
Thanks for the explanations. I'm happy with or without it.
--
Pedro Alves