aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPaul Koning <pkoning@equallogic.com>2011-10-26 15:10:38 +0000
committerPaul Koning <pkoning@equallogic.com>2011-10-26 15:10:38 +0000
commit5110b5dfaa752248bf4f6f1b972f26558ddde062 (patch)
tree6462a309ae93f161a8c79bba3dc1ca9cc145c034 /gdb
parentab964825cce724a63df53e90bf609f0d5ae6814d (diff)
downloadgdb-5110b5dfaa752248bf4f6f1b972f26558ddde062.zip
gdb-5110b5dfaa752248bf4f6f1b972f26558ddde062.tar.gz
gdb-5110b5dfaa752248bf4f6f1b972f26558ddde062.tar.bz2
* gdb.texinfo (gdb.types): Document new deepitems function.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/doc/ChangeLog4
-rw-r--r--gdb/doc/gdb.texinfo29
2 files changed, 33 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 5b38a67..403675e 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-26 Paul Koning <paul_koning@dell.com>
+
+ * gdb.texinfo (gdb.types): Document new deepitems function.
+
2011-10-25 Paul Koning <paul_koning@dell.com>
PR python/13327
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 853692c..b451a6a 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -24424,6 +24424,35 @@ Return @code{True} if @var{type}, assumed to be a type with fields
@item make_enum_dict (@var{enum_type})
Return a Python @code{dictionary} type produced from @var{enum_type}.
+
+@item deepitems (@var{type})
+Returns a Python iterator similar to the standard
+@code{gdb.Type.iteritems} method, except that the iterator returned
+by @code{deepitems} will recursively traverse anonymous struct or
+union fields. For example:
+
+@smallexample
+struct A
+@{
+ int a;
+ union @{
+ int b0;
+ int b1;
+ @};
+@};
+@end smallexample
+
+@noindent
+Then in @value{GDBN}:
+@smallexample
+(@value{GDBP}) python import gdb.types
+(@value{GDBP}) python struct_a = gdb.lookup_type("struct A")
+(@value{GDBP}) python print struct_a.keys ()
+@{['a', '']@}
+(@value{GDBP}) python print [k for k,v in gdb.types.deepitems(struct_a)]
+@{['a', 'b0', 'b1']@}
+@end smallexample
+
@end table
@node gdb.prompt