This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Regression on py-prettyprint.exp: print estring [Re: Your INTERMEDIATE_ENCODING patch for Solaris]


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]