On 11/15/2011 09:10 AM, Keith Seitz wrote: > On 11/14/2011 12:28 PM, Tom Tromey wrote: > >> Actually, thinking about it more, it seems to me that it would be ok for >> these cases to just be errors. There's no really good way to refer to >> the anonymous field as its own entity, and I don't think we should hack >> up the parser and whatever else to support this. > > An error... I'm not so sure that I like that, but to be honest, I'm not > sure I like/dislike it sufficiently to argue about it. Ok, so in the end, I've decided against making this an error. Instead, what I've implemented is analogous to how varobj/MI currently deal with the CPLUS_FAKE_CHILD cases: path expressions and the like are "". If you would like me to do otherwise, please let me know. I am attaching the latest incarnation of this patch, which covers all these cases (AFAIK) and utilizes the new varobj tree testing that I committed last week. What do you think? Keith ChangeLog 2011-12-02 Keith Seitz PR mi/10586 Based on work by Nick Roberts : * varobj.c [ANONYMOUS_STRUCT_NAME]: New constant. [ANONYMOUS_UNION_NAME]: Likewise. (is_anonymous_child): New function. (create_child_with_value): If the child is nameless, synthesize a name for it. (c_describe_child): If the child has no field or type names for a union or sturct, use ANONYMOUS_STRUCT_NAME or ANONYMOUS_UNION_NAME. Set path expression for these fields to the empty string. (cplus_describe_child): Likewise. (is_path_expr_parent): New function. (get_path_expr_parent): New function. testsuite/ChangeLog 2011-12-02 Keith Seitz PR mi/10586 * gdb.mi/mi-var-cp.cc (anonymous_structs): New function. (class A): New class. (class B): New class. (main): Call anonymous_structs. * gdb.mi/mi-var-cp.exp: Add anonymous struct tests and adjust test results. * gdb.mi/mi2-var-cp.exp: Likewise. * gdb.mi/var-cmd.c (struct _simple_struct): Add two anonymous structs. * gdb.mi/mi-var-dislay.exp: Add anonymous struct tests and adjust test results. * gdb.mi/mi2-var-display.exp: Likewise.