This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA: document Value.__init__
- From: Tom Tromey <tromey at redhat dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: joel dot borggren dot franck at gmail dot com, andre dot poenitz at nokia dot com, gdb-patches at sourceware dot org
- Date: Tue, 21 Sep 2010 15:56:17 -0600
- Subject: Re: RFA: document Value.__init__
- References: <AANLkTim24XZssayO6-wvf9WoywRauqXRbUdQi5LjyO9F@mail.gmail.com> <m3iq26x548.fsf@fleche.redhat.com> <AANLkTi=cBL9Cwu5NeX5yVupXwDbam0j3_gXFPGs0WXgz@mail.gmail.com> <201009161148.37670.andre.poenitz@nokia.com> <AANLkTinqU_uKORndRP7A8Ouy406TOb6WKz8y1eiOHDGP@mail.gmail.com> <m3wrqlpkpd.fsf@fleche.redhat.com> <AANLkTi=JBFao0sFtB+yKesANUqGWKLxX40St782jS1zN@mail.gmail.com> <m3pqw6eua9.fsf_-_@fleche.redhat.com> <83wrqex22c.fsf@gnu.org>
Eli> OK, but the long list of conversions in the first paragraph could use
Eli> a @table, I think.
How about this?
Tom
2010-09-21 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Values From Inferior): Mention Value.__init__.
Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.764
diff -u -r1.764 gdb.texinfo
--- gdb.texinfo 15 Sep 2010 19:31:59 -0000 1.764
+++ gdb.texinfo 21 Sep 2010 21:54:48 -0000
@@ -20774,6 +20774,41 @@
The following methods are provided:
@table @code
+@defmethod Value __init__ @var{val}
+Many Python values can be converted directly to a @code{gdb.Value} via
+this object initializer. Specifically:
+
+@table @asis
+@item Python boolean
+A Python boolean is converted to the boolean type from the current
+language.
+
+@item Python integer
+A Python integer is converted to the C @code{long} type for the
+current architecture.
+
+@item Python long
+A Python long is converted to the C @code{long long} type for the
+current architecture.
+
+@item Python float
+A Python float is converted to the C @code{double} type for the
+current architecture.
+
+@item Python string
+A Python string is converted to a target string, using the current
+target encoding.
+
+@item @code{gdb.Value}
+If @code{val} is a @code{gdb.Value}, then a copy of the value is made.
+
+@item @code{gdb.LazyString}
+If @code{val} is a @code{gdb.LazyString} (@pxref{Lazy Strings In
+Python}), then the lazy string's @code{value} method is called, and
+its result is used.
+@end table
+@end defmethod
+
@defmethod Value cast type
Return a new instance of @code{gdb.Value} that is the result of
casting this instance to the type described by @var{type}, which must