From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76851 invoked by alias); 20 Feb 2017 18:20:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 76830 invoked by uid 89); 20 Feb 2017 18:20:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=Hx-languages-length:998, HX-PHP-Originating-Script:rcube.php X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Feb 2017 18:20:01 +0000 Received: by simark.ca (Postfix, from userid 33) id 722DE1E18F; Mon, 20 Feb 2017 13:19:59 -0500 (EST) To: Matthew Malcomson Subject: Re: [PATCH] fix bug with command `printf "%s\n", $_as_string($pc)` X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 20 Feb 2017 18:20:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: <959cdc8e-1e54-a2e7-53d0-d80aaaea9ea8@gmail.com> References: <959cdc8e-1e54-a2e7-53d0-d80aaaea9ea8@gmail.com> Message-ID: <1d49ea752aae175256c0278bf3a999bc@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.3 X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00545.txt.bz2 On 2017-02-19 12:32, Matthew Malcomson wrote: > diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c > index eb3d307b19..c786f68865 100644 > --- a/gdb/python/py-value.c > +++ b/gdb/python/py-value.c > @@ -1615,7 +1615,7 @@ convert_value_from_python (PyObject *obj) > gdb::unique_xmalloc_ptr s > = python_string_to_target_string (obj); > if (s != NULL) > - value = value_cstring (s.get (), strlen (s.get ()), > + value = value_cstring (s.get (), strlen (s.get ()) + 1, > builtin_type_pychar); > } > else if (PyObject_TypeCheck (obj, &value_object_type)) This fix looks good to me. One test (py-mi.exp) needs to be updated though. You can run all the Python-related tests using: $ make check TESTS="gdb.python/*.exp" Normally, the Python tests all pass reliably, unlike some other parts of the testsuite. It might also be good to improve gdb.python/py-as-string.exp to include a test for this bug. Thanks, Simon