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

Tom Tromey
2011-10-19T20:49:38Z

>>>>> "Paul" == Paul Koning <paulkoning@comcast.net> writes:

Paul> So we have:
Paul> 1. Type field lookup: flat
Paul> 2. Type iteration: flat
Paul> 3. Value field lookup: recursive
Paul> 4. [Value iteration: flat] (not submitted yet)

Paul> And Yu's proposed change makes #2 recursive (but does not change #1).

Paul> I think minimally things need to be pairwise the same (1 and 2, 3 and
Paul> 4). It seems most logical for all four to be the same. My preference
Paul> would be all four recursive, but flat/flat, recursive/recursive is a
Paul> reasonable fallback especially if we add sample code for recursive
Paul> walk of gdb.Type to the gdb Python library.

I think making them all 'flat' is probably best.

My reason is that with the proposed patch, I don't think there is a way
to inspect a Type to discover that it has an anonymous field. But, this
seems like a reasonable thing to want to do. That is, I think accurate
introspection is more valuable than notational convenience.

I would be in favor of helper functions in gdb.types, though.

Tom