From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15691 invoked by alias); 3 Apr 2009 00:23:47 -0000 Received: (qmail 15681 invoked by uid 22791); 3 Apr 2009 00:23:47 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Apr 2009 00:23:40 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n330NaWa031460; Thu, 2 Apr 2009 20:23:37 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n330NaEi024728; Thu, 2 Apr 2009 20:23:37 -0400 Received: from opsy.redhat.com (vpn-12-111.rdu.redhat.com [10.11.12.111]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n330NY2e017405; Thu, 2 Apr 2009 20:23:35 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 934B0C881B9; Thu, 2 Apr 2009 18:23:31 -0600 (MDT) To: Thiago Jung Bauermann Cc: gdb-patches@sourceware.org Subject: Re: Python pretty-printing [2/6] References: <1238711355.3236.51.camel@localhost.localdomain> From: Tom Tromey Reply-To: Tom Tromey Date: Fri, 03 Apr 2009 00:23:00 -0000 In-Reply-To: <1238711355.3236.51.camel@localhost.localdomain> (Thiago Jung Bauermann's message of "Thu\, 02 Apr 2009 19\:29\:14 -0300") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2009-04/txt/msg00054.txt.bz2 >>>>> "Thiago" == Thiago Jung Bauermann writes: Tom> This patch adds a minimal Python wrapper for struct objfile, Tom> and arranges to auto-load Python code when an objfile is created. Thiago> Hooray. Just a few comments... Thanks for looking at this. I've found that seeing the Python patches again, out of context, helps me look at them anew. Apparently this works for you too :-) Thiago> IMHO these should go in the "Objfiles In Python" section, like e.g. Thiago> gdb.selected_frame goes in the "Frames In Python" section. Thanks, will do. Thiago> So perhaps you should: > tmp = self->printers; > Py_INCREF (value); > self->printers = value; > Py_XDECREF (tmp); Thiago> You certainly have more experience in this area than me though. WDYT? Good catch. I will make this change. I think one failing case is just: objfile.pretty_printers = objfile.pretty_printers Tom> +/* Return the Python object of type Objfile representing OBJFILE. If Tom> + the object has already been created, return it. Otherwise, create Tom> + it. Return NULL and set the Python error on failure. */ Tom> +PyObject * Tom> +objfile_to_objfile_object (struct objfile *objfile) Thiago> Perhaps it would be useful to mention that this function returns a Thiago> borrowed reference to the object? Will do. Thiago> Also, just to check: the lack of testcases is because you believe this Thiago> code is tested enough with python-prettyprint.exp in a later patch? You know, I am not sure. This class doesn't provide much behavior yet. And, the most important bits are tested by the pretty-printer. I'm inclined not to bother, but if you (or anybody) thinks it is important, I suppose I can whip something up. Tom