This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Make the "python" command resemble the standard Python interpreter
Hi,
On Jan 20, 2012, at 4:22 PM, Tom Tromey wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> 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.
Yit
January 22, 2012