From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14215 invoked by alias); 25 Sep 2009 19:03:41 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 14149 invoked by uid 22791); 25 Sep 2009 19:03:40 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org From: Tom Tromey To: Richard Ward Cc: archer@sourceware.org Subject: Re: Patch to add rtti_type member to gdb.Value References: <4ABA6ADD.4000003@googlemail.com> Reply-To: Tom Tromey Date: Fri, 25 Sep 2009 19:03:00 -0000 In-Reply-To: <4ABA6ADD.4000003@googlemail.com> (Richard Ward's message of "Wed, 23 Sep 2009 19:37:17 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2009-q3/txt/msg00252.txt.bz2 >>>>> "Richard" == Richard Ward writes: Richard> This patch adds value gdb.Value.rtti_type to go along side Richard> gdb.Value.type. the type represents the type of the value determined Richard> by rtti. Luckily it turns out that the info is already available in Richard> gdb's value struct, where it has already been properly determined, so Richard> there is no need to call any real gdb code. This just exposes Richard> it. Is that always the case? I ask because other code, like the code implementing "set print object on", uses value_rtti_type and/or value_rtti_target_type. The patch also has some non-GNU-formatted code; no big deal, just a bunch of nits to clean up. Richard> It is very similar to valpy_get_type (without what appears to Richard> be an unnecessary Py_INCREF). The code: value_object *obj = (value_object *) self; if (!obj->type) { obj->type = type_to_type_object (value_type (obj->value)); if (!obj->type) { obj->type = Py_None; Py_INCREF (obj->type); } } Py_INCREF (obj->type); return obj->type; The first Py_INCREF is there because obj->type must be a new reference to an object. That lets us pair with the decre at object destruction. It looks weird, being on Py_None, but I think that is still correct. The second Py_INCREF is so that we always return a new reference to our caller. So, I think they are both needed. But if not, I definitely want to know about it, and why :-) Tom