Index: gdb.base/ptype.c =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/ptype.c,v retrieving revision 1.4 diff -u -p -r1.4 ptype.c --- gdb.base/ptype.c 4 Jan 2006 14:46:17 -0000 1.4 +++ gdb.base/ptype.c 28 Aug 2007 17:43:28 -0000 @@ -198,6 +198,16 @@ struct outer_struct { long outer_long; } nested_su; +struct highest +{ + int a; + struct + { + int b; + struct { int c; } anonymous_level_2; + } anonymous_level_1; +} the_highest; + /**** Enumerations *******/ enum @@ -352,6 +362,8 @@ int main () nested_su.outer_int = 0; v_t_struct_p = 0; + the_highest.a = 0; + v_boolean = FALSE; v_boolean2 = my_false; return 0; Index: gdb.base/ptype.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/ptype.exp,v retrieving revision 1.11 diff -u -p -r1.11 ptype.exp --- gdb.base/ptype.exp 23 Aug 2007 18:14:17 -0000 1.11 +++ gdb.base/ptype.exp 28 Aug 2007 17:43:28 -0000 @@ -532,6 +532,22 @@ gdb_test "ptype nested_su.inner_struct_i gdb_test "ptype nested_su.inner_union_instance" "type = union ${outer}inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype nested union" +# Print the type description of variable the_highest, and verify that +# the type description for the fields whose type is anonymous are +# correctly printed (at nesting level 1 and 2). + +gdb_test "ptype the_highest" \ + "type = struct highest \{.*\[\r\n\] *int a;.*\[\r\n\] *struct \{.*\[\r\n\] *int b;.*\[\r\n\] *struct \{\.\.\.\} anonymous_level_2;.*\[\r\n\] *\} anonymous_level_1;.*\[\r\n\]}.*" \ + "ptype the_highest" + +# Print the type descrption for one of the fields of variable the_highest. +# The purpose is to verify that the type of a field that was printed above +# as "struct {...}" is now printed in a more descriptive way (because the +# nesting level is now one level less). + +gdb_test "ptype the_highest.anonymous_level_1" \ + "type = struct \{.*\[\r\n\] *int b;.*\[\r\n\] *struct \{.*\[\r\n\] *int c;.*\[\r\n\] *\} anonymous_level_2;.*\[\r\n\]}.*" \ + "ptype the_highest" get_debug_format