This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH v2] gdb/python: add missing handling for anonymous members of struct and union
- From: Tom Tromey <tromey at redhat dot com>
- To: Paul Koning <paulkoning at comcast dot net>
- Cc: Li Yu <raise dot sail at gmail dot com>, gdb-patches at sourceware dot org
- Date: Tue, 04 Oct 2011 14:23:51 -0600
- Subject: Re: [PATCH v2] gdb/python: add missing handling for anonymous members of struct and union
- References: <4E8595F6.firstname.lastname@example.org> <email@example.com> <ABB9CE3B-04DC-4EA9-A25A-F3590025AB5C@comcast.net>
>>>>> "Paul" == Paul Koning <firstname.lastname@example.org> writes:
Tom> I don't understand why the iterator iterates into sub-objects. Why not
Tom> just have a flat iterator? That is, return a field with no name whose
Tom> type is some structure, and then let the caller iterate over that type
Tom> if need be.
Paul> That's the current behavior. Yu showed an example where he wanted
Paul> to get all the field names so he could then use those to retrieve
Paul> the fields in a gdb.Value object.
Ok, I see. Thanks.
Paul> (Value objects don't currently have iterators; I'll propose a
Paul> patch for that shortly.)
Thanks, after reading your other patch I was meaning to see if this was
Paul> You can certainly do this in Python, for example:
Why don't we do that, then, in some code in the gdb python library?
Paul> (This could be done more elegantly if gdb.Type could be subclassed.)
It seems reasonable to me.