This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Oct 19, 2011, at 4:49 PM, Tom Tromey wrote:

>>>>>> "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.

So I think that amounts to rejecting Yu's patch.

Also, given my point 3, does that mean we should change val["foo"] so it doesn't recurse down into anonymous fields as it does today?  That would be a change in behavior for an existing feature.

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

What did you have in mind?

	paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]