Re: [PATCH v2] gdb/python: add missing handling for anonymous members of struct and union

Tom Tromey
2011-10-04T20:24:10Z

>>>>> "Paul" == Paul Koning <paulkoning@comcast.net> 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
needed :)

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.

Tom