aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2013-12-12 15:18:27 -0800
committerSiva Chandra <sivachandra@chromium.org>2013-12-12 15:21:53 -0800
commita16b0e220dfc49ed814e779d45faab84e31a4e42 (patch)
tree67f4c4a03309af6cd25582dd435d97781a24ca53 /gdb/doc
parentec0d6081a0144a61dfc79a10aaf2b96e29286180 (diff)
downloadgdb-a16b0e220dfc49ed814e779d45faab84e31a4e42.zip
gdb-a16b0e220dfc49ed814e779d45faab84e31a4e42.tar.gz
gdb-a16b0e220dfc49ed814e779d45faab84e31a4e42.tar.bz2
2013-12-12 Siva Chandra Reddy <sivachandra@google.com>
PR python/16113 * NEWS (Python Scripting): Add entry for the new feature and the new attribute of gdb.Field objects. * python/py-type.c (gdbpy_is_field): New function (convert_field): Add 'parent_type' attribute to gdb.Field objects. * python/py-value.c (valpy_getitem): Allow subscript value to be a gdb.Field object. (value_has_field): New function (get_field_flag): New function * python/python-internal.h (gdbpy_is_field): Add declaration. testsuite/ * gdb.python/py-value-cc.cc: Improve test case. * gdb.python/py-value-cc.exp: Add new tests to test usage of gdb.Field objects as subscripts on gdb.Value objects. doc/ * gdb.texinfo (Values From Inferior): Add a note about using gdb.Field objects as subscripts on gdb.Value objects. (Types In Python): Add description about the new attribute "parent_type" of gdb.Field objects.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/ChangeLog8
-rw-r--r--gdb/doc/gdb.texinfo16
2 files changed, 23 insertions, 1 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index d1f969c..7db94e7 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,11 @@
+2013-12-12 Siva Chandra Reddy <sivachandra@google.com>
+
+ PR python/16113
+ * gdb.texinfo (Values From Inferior): Add a note about using
+ gdb.Field objects as subscripts on gdb.Value objects.
+ (Types In Python): Add description about the new attribute
+ "parent_type" of gdb.Field objects.
+
2013-12-12 Joel Brobecker <brobecker@adacore.com>
* gdb.texinfo (GDB/MI Miscellaneous Commands): Add @cindex
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index d7c90f5..b7551c2 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -23985,7 +23985,17 @@ can access its @code{foo} element with:
bar = some_val['foo']
@end smallexample
-Again, @code{bar} will also be a @code{gdb.Value} object.
+@cindex getting structure elements using gdb.Field objects as subscripts
+Again, @code{bar} will also be a @code{gdb.Value} object. Structure
+elements can also be accessed by using @code{gdb.Field} objects as
+subscripts (@pxref{Types In Python}, for more information on
+@code{gdb.Field} objects). For example, if @code{foo_field} is a
+@code{gdb.Field} object corresponding to element @code{foo} of the above
+structure, then @code{bar} can also be accessed as follows:
+
+@smallexample
+bar = some_val[foo_field]
+@end smallexample
A @code{gdb.Value} that represents a function can be executed via
inferior function call. Any arguments provided to the call must match
@@ -24367,6 +24377,10 @@ this will be zero; in this case the field's size is given by its type.
@item type
The type of the field. This is usually an instance of @code{Type},
but it can be @code{None} in some situations.
+
+@item parent_type
+The type which contains this field. This is an instance of
+@code{gdb.Type}.
@end table
@end defun