This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RFA: document Value.__init__ (Was: Python API questions and use cases)
- From: Tom Tromey <tromey at redhat dot com>
- To: Joel BorggrÃn-Franck <joel dot borggren dot franck at gmail dot com>
- Cc: Andrà PÃnitz <andre dot poenitz at nokia dot com>, gdb-patches at sourceware dot org
- Date: Tue, 21 Sep 2010 14:06:06 -0600
- Subject: RFA: document Value.__init__ (Was: Python API questions and use cases)
- 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>
>>>>> "Joel" == Joel BorggrÃn-Franck <joel.borggren.franck@gmail.com> writes:
Joel> I can't find documentation for the constructor Andrà showed me:
Joel> gdb.Value(addr).
Here is a patch to document this constructor.
Ok?
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 20:05:54 -0000
@@ -20774,6 +20774,22 @@
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, Python booleans are converted
+to boolean type from the current language; Python integers are
+converted to the C @code{long} type for the current architecture;
+Python longs are converted to the C @code{long long} type for the
+current architecture; Python floats are converted to the C
+@code{double} type for the current architecture; and Python strings
+are converted to target strings, using the current target encoding.
+
+@code{val} can also be a @code{gdb.Value}, in which case a copy of the
+value is returned, or a @code{gdb.LazyString} (@pxref{Lazy Strings In
+Python}), in which case the lazy string's @code{value} method is
+called, and its result is returned.
+@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