* gdb.python/lib-types.cc (struct A): New structure.
authorPaul Koning <pkoning@equallogic.com>
Wed, 26 Oct 2011 15:10:11 +0000 (15:10 +0000)
committerPaul Koning <pkoning@equallogic.com>
Wed, 26 Oct 2011 15:10:11 +0000 (15:10 +0000)
        * gdb.python/lib-types.exp (deepitems): New tests.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/lib-types.cc
gdb/testsuite/gdb.python/lib-types.exp

index db459a4..00d2161 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-26  Paul Koning  <paul_koning@dell.com>
+
+       * gdb.python/lib-types.cc (struct A): New structure.
+       * gdb.python/lib-types.exp (deepitems): New tests.
+       
 2011-10-25  Paul Koning  <paul_koning@dell.com>
 
        PR python/13327
index 10df961..b822250 100644 (file)
@@ -54,6 +54,34 @@ enum enum1 { A, B, C };
 
 enum1 enum1_obj (A);
 
+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;
+       };
+};
+
+struct A a = {1,20,3,40};
+
 int
 main ()
 {
index 1eb4e19..e3a65ab 100644 (file)
@@ -138,3 +138,8 @@ gdb_test_no_output "python enum1_dict = gdb.types.make_enum_dict (enum1_obj.type
 gdb_test_no_output "python enum1_list = enum1_dict.items ()"
 gdb_test_no_output "python enum1_list.sort ()"
 gdb_test "python print enum1_list" {\[\('A', 0L\), \('B', 1L\), \('C', 2L\)\]}
+
+# test deepitems
+gdb_test_no_output "python struct_a = gdb.lookup_type ('struct A')"
+gdb_test "python print struct_a.keys ()" {\['a', '', 'c', ''\]}
+gdb_test "python print \[k for k,v in gdb.types.deepitems(struct_a)\]" {\['a', 'b0', 'b1', 'bb0', 'bb1', 'bbb0', 'bbb1', 'c', 'dd0', 'dd1', 'd2', 'd3'\]}