From: Paul Koning Date: Wed, 26 Oct 2011 15:10:11 +0000 (+0000) Subject: * gdb.python/lib-types.cc (struct A): New structure. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ab964825cce724a63df53e90bf609f0d5ae6814d;p=binutils-gdb.git * gdb.python/lib-types.cc (struct A): New structure. * gdb.python/lib-types.exp (deepitems): New tests. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index db459a40721..00d21610b00 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-10-26 Paul Koning + + * gdb.python/lib-types.cc (struct A): New structure. + * gdb.python/lib-types.exp (deepitems): New tests. + 2011-10-25 Paul Koning PR python/13327 diff --git a/gdb/testsuite/gdb.python/lib-types.cc b/gdb/testsuite/gdb.python/lib-types.cc index 10df9613577..b8222501cc8 100644 --- a/gdb/testsuite/gdb.python/lib-types.cc +++ b/gdb/testsuite/gdb.python/lib-types.cc @@ -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 () { diff --git a/gdb/testsuite/gdb.python/lib-types.exp b/gdb/testsuite/gdb.python/lib-types.exp index 1eb4e199230..e3a65aba0da 100644 --- a/gdb/testsuite/gdb.python/lib-types.exp +++ b/gdb/testsuite/gdb.python/lib-types.exp @@ -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'\]}