From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28394 invoked by alias); 16 Sep 2010 09:49:33 -0000 Received: (qmail 28385 invoked by uid 22791); 16 Sep 2010 09:49:33 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TRACKER_ID,TW_SN,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Sep 2010 09:49:26 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8G9nPeV014212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 Sep 2010 05:49:25 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8G9nMBg007423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Sep 2010 05:49:24 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o8G9nMQA015579; Thu, 16 Sep 2010 11:49:22 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o8G9nLuk015578; Thu, 16 Sep 2010 11:49:21 +0200 Date: Thu, 16 Sep 2010 17:51:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: Pierre Muller , gdb-patches@sourceware.org Subject: [patch] Regression on py-prettyprint.exp: print estring [Re: Your INTERMEDIATE_ENCODING patch for Solaris] Message-ID: <20100916094921.GA5781@host1.dyn.jankratochvil.net> References: <001b01cb48ee$6b8425f0$428c71d0$@muller@ics-cnrs.unistra.fr> <44796.6229789474$1283326243@news.gmane.org> <000301cb4aa0$7c44fd70$74cef850$@muller@ics-cnrs.unistra.fr> <002301cb54bc$661506f0$323f14d0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) X-IsSubscribed: yes 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 X-SW-Source: 2010-09/txt/msg00300.txt.bz2 On Wed, 15 Sep 2010 22:18:07 +0200, Tom Tromey wrote: > Great. Here is what I am checking in. > > 2010-09-15 Tom Tromey > > * charset.c (iconv_open): New define. > (iconv): Likewise. > (iconv_close): Likewise. > (phony_iconv_open): Add "phony_" prefix. > (phony_iconv_close): Likewise. > (phony_iconv): Likewise. > * gdb_wchar.h: Check _LIBICONV_VERSION, __STDC_ISO_10646__. > Change how INTERMEDIATE_ENCODING is defined. 562fabbaa40fe9e601eddc2e0ab3c8cc615cf9a3 This patch has a regression on all the tested OSes {x86_64,x86_64-m32,i686}-fedora{12,13,14snapshot}-linux-gnu: (gdb) print estring $7 = "embedded x\201\202\203\204" PASS: gdb.python/py-prettyprint.exp: print estring -> (gdb) print estring $7 = "embedded \201\202\203\204" (gdb) FAIL: gdb.python/py-prettyprint.exp: print estring due to the change: INTERMEDIATE_ENCODING = "wchar_t" -> INTERMEDIATE_ENCODING = "UCS-4LE" echo 'char s[]="ab\201";'|gcc -o 1.o -c -g -x c -;./gdb -nx -q -ex 'p s' -ex q ./1.o $1 = "ab\201" -> $1 = "a\201" The fix has no regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu. Test OpenSolaris 2009.06 snv_111b X86 shows no problem even with FSF GDB HEAD; there was no libiconv so charset.exp is UNTESTED. (I did not try GNU libiconv on OpenSolaris). The fix seems generally correct to me anyway. The conversion may not stop when it seens no more output space as the input may no longer produce any output. It is more questionable why wchar_t worked (and how is it different in glibc iconv). Thanks, Jan gdb/ 2010-09-16 Jan Kratochvil * charset.c (wchar_iterate) : Return any possibly converted characters. --- a/gdb/charset.c +++ b/gdb/charset.c @@ -648,8 +648,13 @@ wchar_iterate (struct wchar_iterator *iter, switch (errno) { case EILSEQ: - /* Invalid input sequence. Skip it, and let the caller - know about it. */ + /* Invalid input sequence. We still might have converted a + character; if so, return it. */ + if (out_avail < out_request * sizeof (gdb_wchar_t)) + break; + + /* Otherwise skip the first invalid character, and let the + caller know about it. */ *out_result = wchar_iterate_invalid; *ptr = iter->input; *len = iter->width;