aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Koning <pkoning@equallogic.com>2011-10-26 15:10:11 +0000
committerPaul Koning <pkoning@equallogic.com>2011-10-26 15:10:11 +0000
commitab964825cce724a63df53e90bf609f0d5ae6814d (patch)
tree02c549d6bf92909dc95168d4ea67a833d61c9b71
parent3eaf3fa2966a7174d42c8b94ad171e2de4665410 (diff)
downloadgdb-ab964825cce724a63df53e90bf609f0d5ae6814d.zip
gdb-ab964825cce724a63df53e90bf609f0d5ae6814d.tar.gz
gdb-ab964825cce724a63df53e90bf609f0d5ae6814d.tar.bz2
* gdb.python/lib-types.cc (struct A): New structure.
* gdb.python/lib-types.exp (deepitems): New tests.
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.python/lib-types.cc28
-rw-r--r--gdb/testsuite/gdb.python/lib-types.exp5
3 files changed, 38 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index db459a4..00d2161 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -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
diff --git a/gdb/testsuite/gdb.python/lib-types.cc b/gdb/testsuite/gdb.python/lib-types.cc
index 10df961..b822250 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 1eb4e19..e3a65ab 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'\]}