From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2112 invoked by alias); 1 Jul 2011 10:31:58 -0000 Received: (qmail 2103 invoked by uid 22791); 1 Jul 2011 10:31:57 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jul 2011 10:31:43 +0000 Received: by vxg38 with SMTP id 38so2911285vxg.0 for ; Fri, 01 Jul 2011 03:31:43 -0700 (PDT) Received: by 10.220.38.138 with SMTP id b10mr1116253vce.48.1309516303119; Fri, 01 Jul 2011 03:31:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.188.75 with HTTP; Fri, 1 Jul 2011 03:31:23 -0700 (PDT) In-Reply-To: References: From: Kevin Pouget Date: Fri, 01 Jul 2011 10:31:00 -0000 Message-ID: Subject: Re: [PATCH] sys.argv and ipython (interactive python) support in GDB/Python To: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00008.txt.bz2 hello, just one thing, you're patch doesn't compile on my computer because of this= line +=A0 char *argv[] =3D { "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 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 > > =A0(gdb) python execfile("/usr/bin/ipython") > =A0Python 2.6.6 (r266:84292, Oct =A09 2010, 12:40:51) > =A0... > =A0In [1]: import gdb > =A0In [2]: print gdb.lookup_symbol("main") > =A0(, 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,