This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Regression on py-prettyprint.exp: print estring [Re: Your INTERMEDIATE_ENCODING patch for Solaris]
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>, gdb-patches at sourceware dot org
- Date: Thu, 16 Sep 2010 11:49:21 +0200
- Subject: [patch] Regression on py-prettyprint.exp: print estring [Re: Your INTERMEDIATE_ENCODING patch for Solaris]
- References: <m339twkmj5.fsf@fleche.redhat.com> <001b01cb48ee$6b8425f0$428c71d0$@muller@ics-cnrs.unistra.fr> <m3k4n6hgqe.fsf@fleche.redhat.com> <44796.6229789474$1283326243@news.gmane.org> <m362yp9kaj.fsf@fleche.redhat.com> <000301cb4aa0$7c44fd70$74cef850$@muller@ics-cnrs.unistra.fr> <m362yo88fj.fsf@fleche.redhat.com> <m3hbhs59iu.fsf@fleche.redhat.com> <002301cb54bc$661506f0$323f14d0$@muller@ics-cnrs.unistra.fr> <m3aaniwykg.fsf@fleche.redhat.com>
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 <tromey@redhat.com>
>
> * 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 <jan.kratochvil@redhat.com>
* charset.c (wchar_iterate) <EILSEQ>: 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;