This is the mail archive of the 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: ipython (interactive python) support in GDB/Python

I haven't figured out a fix yet, but I currently workaround the issue by

  $ rlwrap gdb

Even with rlwrap, autocompletion in GDB is still done by GDB.
rlwrap will take over once you entered to ipython. However,
after you exit() from ipython, rlwrap completer seems to take over
initial GDB completer, so symbol autocompletion will be lost.

From above symptoms, this whole problem seems to be a
issue of completer function selection in readline. I think
it is feasible to do a fix, but I still haven't figured out yet.

Best Regards,

> while testing this ipython shell from GDB (cf below/patch mailing
> list), I noticed that the commandline is not behaving correctly: the
> arrows (history, line modification) don't work, and neither does the
> autocompletion, and it's the same for the python debugger, PDB
> do you think there might be something feasible to fix it ?
>> While working with GDB/Python, I wondered if I can use it
>> interactively by loading ipython (interactive python shell) on
>> top of it. However, current GDB/Python fails as it does not
>> initialize sys.argv properly.
>> So here is a patch to set sys.argv when initializing embedded
>> Python interpreter. I have tested it by running ipython with
>> ?(gdb) python execfile("/usr/bin/ipython")
>> ?Python 2.6.6 (r266:84292, Oct ?9 2010, 12:40:51)
>> ?...
>> ?In [1]: import gdb
>> ?In [2]: print gdb.lookup_symbol("main")
>> ?(<gdb.Symbol object at 0x7ff6f9815b20>, False)
>> It is quite nice to be able to inspect debuggee interactively
>> using full-featured language.
>> This patch should also improve compatibility with other exsiting
>> python libraries, as some of those expect existance of sys.argv.

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