This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Make the "python" command resemble the standard Python interpreter


On Sun, Jan 22, 2012 at 8:42 AM, Khoo Yit Phang <khooyp@cs.umd.edu> wrote:
> 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.

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]