From fbb8f2990ccfa180274ab4a578818fe247823540 Mon Sep 17 00:00:00 2001 From: Phil Muldoon Date: Fri, 10 Jul 2009 10:35:17 +0000 Subject: 2009-07-10 Phil Muldoon * python/python-internal.h (apply_varobj_pretty_printer): Update definition. (python_string_to_target_python_string): Add definition. * python/python-utils.c (unicode_to_encoded_python_string) (unicode_to_target_python_string) (python_string_to_target_python_string): New Functions. * python/python-prettyprint.c (pretty_print_one_value): Likewise. (print_string_repr): Refactor to logic to account for PyObject returned strings. (apply_varobj_pretty_printer): Likewise. * python/python-value.c (valpy_string): Parse length keyword. Use length keyword in LA_GET_STRING. * varobj.c (value_get_print_value): Refactor logic to account for PyObject returned strings. * c-lang.c (c_get_string): If the length parameter is specified, use that. Return value in characters. Update comments. * language.h: Update c_get_string prototype comments. 2009-07-10 Phil Muldoon * gdb.texinfo (Values From Inferior): Add length parameter description. 2009-07-10 Phil Muldoon * gdb.python/python-prettyprint.c: Add counted null string structure. * gdb.python/python-prettyprint.exp: Print null string. Test for embedded nulls. * gdb.python/python-prettyprint.py (pp_ns): New Function. * gdb.python/python-value.exp (test_value_in_inferior): Add variable length string fetch tests. * gdb.python/python-value.c (main): Add strings for string fetch tests. --- gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'gdb/doc') diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index fd70a89..ff5bff6 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-07-10 Phil Muldoon + + * gdb.texinfo (Values From Inferior): Add length parameter + description. + 2009-07-04 Chris Genly * gdb.texinfo (GDB/MI Variable Objects): Document child definition diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index ab36fa6..0a59f98 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -18894,7 +18894,7 @@ The result @code{bar} will be a @code{gdb.Value} object holding the value pointed to by @code{foo}. @end defmethod -@defmethod Value string @r{[}encoding@r{]} @r{[}errors@r{]} +@defmethod Value string @r{[}encoding@r{]} @r{[}errors@r{]} @r{[}length@r{]} If this @code{gdb.Value} represents a string, then this method converts the contents to a Python string. Otherwise, this method will throw an exception. @@ -18905,7 +18905,9 @@ language. For C-like languages, a value is a string if it is a pointer to or an array of characters or ints. The string is assumed to be terminated -by a zero of the appropriate width. +by a zero of the appropriate width. However if the optional length +argument is given, the string will be converted to that given length, +ignoring any embedded zeros that the string may contain. If the optional @var{encoding} argument is given, it must be a string naming the encoding of the string in the @code{gdb.Value}, such as @@ -18919,6 +18921,9 @@ will be used, if the current language is able to supply one. The optional @var{errors} argument is the same as the corresponding argument to Python's @code{string.decode} method. + +If the optional @var{length} argument is given, the string will be +fetched and converted to the given length. @end defmethod @end table -- cgit v1.1