gdb.Type.fields() missed handling for anonymous members. This patch fix it, below are details: Assume that we have a c source as below: ///////////////////////////// struct A { int a; union { int b0; int b1; union { int bb0; int bb1; union { int bbb0; int bbb1; }; }; }; int c; union { union { int dd0; int dd1; }; int d2; int d3; }; }; int main() { struct A a; } //////////////////////////// And have a python gdb script as below: ########################## v = gdb.parse_and_eval("a") t = v.type fields = t.fields() for f in fields: print "[%s]" % f.name, v[f.name] ########################## Without this patch, above script will print: [a] -7616 [] {{dd0 = 0, dd1 = 0}, d2 = 0, d3 = 0} [c] 0 [] {{dd0 = 0, dd1 = 0}, d2 = 0, d3 = 0} With this patch, above script will print rightly: [a] -7616 [b0] 32767 [b1] 32767 [bb0] 32767 [bb1] 32767 [bbb0] 32767 [bbb1] 32767 [c] 0 [dd0] 0 [dd1] 0 [d2] 0 [d3] 0 Thanks for Paul and Tom's feedback of this patch. This version uses recursion implementation, as we discussed, this patch is passed by "make check" without regression :) Signed-off-by: Li Yu gdb/python/: 2011-10-8 Li Yu * py-type.c: Add process for anonymous members of struct and union py-type.c | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-)