This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] sys.argv and ipython (interactive python) support in GDB/Python
- From: Kevin Pouget <kevin dot pouget at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 1 Jul 2011 12:31:23 +0200
- Subject: Re: [PATCH] sys.argv and ipython (interactive python) support in GDB/Python
- References: <BANLkTi=36=aFZPsBDJacOWvh-2Pk7OHKfQ@mail.gmail.com> <BANLkTimcWKLMOkd0R8bNT-z4yqr0FJ_uog@mail.gmail.com>
hello,
just one thing, you're patch doesn't compile on my computer because of this line
+? char *argv[] = { "gdb", NULL };
error: ISO C90 forbigs mixed declarations and code
but ipython looks very intersting, thanks!
Kevin
On Fri, Jul 1, 2011 at 6:00 AM, Taisuke Yamada <tai@rakugaki.org> wrote:
>
> Hi.
>
> 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.
>
> Best Regards,