From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17742 invoked by alias); 1 Jul 2011 14:10:19 -0000 Received: (qmail 17727 invoked by uid 22791); 1 Jul 2011 14:10:19 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,TW_RG X-Spam-Check-By: sourceware.org Received: from mail-iy0-f169.google.com (HELO mail-iy0-f169.google.com) (209.85.210.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jul 2011 14:10:03 +0000 Received: by iyl8 with SMTP id 8so3679121iyl.0 for ; Fri, 01 Jul 2011 07:10:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.67.207 with SMTP id s15mr2779342ibi.128.1309529402679; Fri, 01 Jul 2011 07:10:02 -0700 (PDT) Received: by 10.231.36.8 with HTTP; Fri, 1 Jul 2011 07:10:02 -0700 (PDT) In-Reply-To: References: Date: Fri, 01 Jul 2011 14:10:00 -0000 Message-ID: Subject: Re: [PATCH] sys.argv and ipython (interactive python) support in GDB/Python From: Taisuke Yamada To: pmuldoon@redhat.com Cc: 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/msg00012.txt.bz2 Hi. >> + =A0char *argv[] =3D { "gdb", NULL }; > > As Kevin noted, this needs to be placed in the declarations part of the f= unction. Yes...I'm now too used to C99 and was too sloppy to move declaration upward= :-) >> =A0 =A0Py_Initialize (); >> + PySys_SetArgvEx (1, argv, 0); > > Isn't your first argument of argv the executable GDB? Not really. I'm just setting "gdb" as a text label to use when generating log message both in python and python library. Just like in C, it *usually* points to executing script itself, but after all, there's nothing that gurantees that. Alternatively, you can do "PySys_SetArgvEx (0, NULL, 0);", but then python will automatically generate empty (=3D "") argv[0]. That means any logs generated will be somewhat odd, so my idea was to have something instead. If you're concerned, maybe "python-gdb" would be better. Best Regards,