From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14125 invoked by alias); 18 Oct 2011 19:03:57 -0000 Received: (qmail 14116 invoked by uid 22791); 18 Oct 2011 19:03:55 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from qmta03.westchester.pa.mail.comcast.net (HELO qmta03.westchester.pa.mail.comcast.net) (76.96.62.32) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Oct 2011 19:03:41 +0000 Received: from omta18.westchester.pa.mail.comcast.net ([76.96.62.90]) by qmta03.westchester.pa.mail.comcast.net with comcast id mJsd1h0061wpRvQ53K3igo; Tue, 18 Oct 2011 19:03:42 +0000 Received: from [10.127.238.91] ([65.206.2.68]) by omta18.westchester.pa.mail.comcast.net with comcast id mK3V1h03W1U2a2h3eK3Y4n; Tue, 18 Oct 2011 19:03:40 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: [PATCH v4] gdb/python: add missing handling for anonymous members of struct and union From: Paul Koning In-Reply-To: <09787EF419216C41A903FD14EE5506DD030CB90864@AUSX7MCPC103.AMER.DELL.COM> Date: Tue, 18 Oct 2011 19:31:00 -0000 Content-Transfer-Encoding: quoted-printable Message-Id: <5BD625B1-6FBB-4640-801F-62C73D4F15EF@comcast.net> References: <09787EF419216C41A903FD14EE5506DD030CB90864@AUSX7MCPC103.AMER.DELL.COM> To: gdb-patches@sourceware.org, Phil Muldoon , Li Yu 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-10/txt/msg00507.txt.bz2 On Oct 18, 2011, at 10:21 AM, wrote: >=20 >=20 > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourcewa= re.org] On Behalf Of Phil Muldoon > Sent: Tuesday, October 18, 2011 9:58 AM > To: Li Yu > Cc: gdb-patches@sourceware.org; Paul Koning; Tom Tromey > Subject: Re: [PATCH v4] gdb/python: add missing handling for anonymous me= mbers of struct and union >=20 > Li Yu writes: >=20 >> gdb.Type.fields() missed handling for anonymous members. >>=20 >> This patch fix it, below are details: >=20 > Sorry I missed this patch. I have some questions. >=20 > Given this functionality, do you have any use-cases in mind for it? Do we= really want to include anonymous members in field () output? I ask because= I cannot decide if the additional anonymous field information constitutes = an API break. If so we may have to reconstitute this functionality from fi= elds() so that it takes a keyword to turn this behavior on and off. I raised a related question two weeks ago: http://sourceware.org/ml/gdb-pat= ches/2011-10/msg00118.html . It would seem logical for things to be consistent. That's quite a lot more= work than this one patch, but it can certainly be handled as a collection = of independent changes.=20=20 Another possible approach is to leave gdb.Type.fields() alone, but supply a= little bit of Python code for the gdb python library that implements a rec= ursive iterator. It's quite easy to do that: def deepitems (t): for k, v in t.iteritems (): if k: yield k, v else: for i in deepitems (v.type): yield i paul