From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15522 invoked by alias); 2 Dec 2008 21:29:31 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 15498 invoked by uid 306); 2 Dec 2008 21:29:30 -0000 Date: Tue, 02 Dec 2008 21:29:00 -0000 Message-ID: <20081202212930.15483.qmail@sourceware.org> From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-python: gdb X-Git-Refname: refs/heads/archer-tromey-python X-Git-Reftype: branch X-Git-Oldrev: 949f9573fce69b4516501c9b9c67cc189ce82b09 X-Git-Newrev: 34a2d37155617498485e65ba9d1964785274e7f1 X-SW-Source: 2008-q4/txt/msg00176.txt.bz2 List-Id: The branch, archer-tromey-python has been updated via 34a2d37155617498485e65ba9d1964785274e7f1 (commit) from 949f9573fce69b4516501c9b9c67cc189ce82b09 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 34a2d37155617498485e65ba9d1964785274e7f1 Author: Tom Tromey Date: Tue Dec 2 14:28:58 2008 -0700 gdb * python/python-value.c (valpy_string): Add "errors" argument. gdb/doc * gdb.texinfo (Values From Inferior): Document new string argument. ----------------------------------------------------------------------- Summary of changes: gdb/ChangeLog | 4 ++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 11 ++++++++--- gdb/python/python-value.c | 7 ++++--- 4 files changed, 21 insertions(+), 6 deletions(-) First 500 lines of diff: diff --git a/gdb/ChangeLog b/gdb/ChangeLog index daa5586..f8287c0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2008-12-02 Tom Tromey + * python/python-value.c (valpy_string): Add "errors" argument. + +2008-12-02 Tom Tromey + * python/lib/gdb/command/backtrace.py (FrameWrapper.__getattr__): Rename from __getattribute__. * python/lib/gdb/backtrace.py (push_frame_filter): Add missing diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 703543b..a786ea1 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2008-12-02 Tom Tromey + + * gdb.texinfo (Values From Inferior): Document new string + argument. + 2008-12-01 Tom Tromey * gdb.texinfo (Basic Python): Document parse_and_eval. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index dfc19aa..1e7a22d 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -18247,7 +18247,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{]} +@defmethod Value string @r{[}encoding @r{[}errors@r{]}@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. @@ -18263,8 +18263,13 @@ by a zero of the appropriate width. If the optional @var{encoding} argument is given, it must be a string naming the encoding of the string in the @code{gdb.Value}. The Python codec machinery will be used to convert the string. If @var{encoding} -is not given, then the @code{target-charset} (@pxref{Character Sets}) -will be used. +is not given, or if @var{encoding} is the empty string, then either +the @code{target-charset} (@pxref{Character Sets}) will be used, or a +language-specific encoding 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. @end defmethod @defmethod Value type diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c index 5a7fae0..342cf28 100644 --- a/gdb/python/python-value.c +++ b/gdb/python/python-value.c @@ -165,10 +165,11 @@ valpy_string (PyObject *self, PyObject *args) volatile struct gdb_exception except; PyObject *unicode; const char *encoding = NULL; + const char *errors = NULL; const char *user_encoding = NULL; const char *la_encoding = NULL; - if (!PyArg_ParseTuple (args, "|s", &user_encoding)) + if (!PyArg_ParseTuple (args, "|ss", &user_encoding, &errors)) return NULL; TRY_CATCH (except, RETURN_MASK_ALL) @@ -187,8 +188,8 @@ valpy_string (PyObject *self, PyObject *args) return NULL; } - encoding = user_encoding? user_encoding : la_encoding; - unicode = PyUnicode_Decode (buffer, length, encoding, NULL); + encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding; + unicode = PyUnicode_Decode (buffer, length, encoding, errors); xfree (buffer); return unicode; hooks/post-receive -- Repository for Project Archer.