iconv returning byte order marks for Solaris 2.9

Andrew
2009-07-15T17:16:56Z

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

Hi

I found a problem printing strings for gdb 6.8 weekly snapshot
(2009 07 07) on Solaris 2.9.

I eventually found that changing INTERMEDIATE_ENCODING
in gdb_wchar.h to "UCS-4" and applying the following
patch worked. Any comments?

I'm not sure how to handle the INTERMEDIATE_ENCODING
change, since it's probably system dependent.

Andrew

[-- Attachment #2: patch_charset.txt --]
[-- Type: text/plain, Size: 671 bytes --]

diff -rau src.original/gdb/charset.c src/gdb/charset.c
--- src.original/gdb/charset.c 2009-07-15 13:05:42.000896000 -0400
+++ src/gdb/charset.c 2009-07-15 13:09:23.000013000 -0400
@@ -646,6 +646,20 @@
*out_chars = iter->out;
*ptr = orig_inptr;
*len = orig_in - iter->bytes;
+
+ if (num > 1) {
+ if ( (iter->out[0] == (gdb_wchar_t) 0xfffe) ||
+ (iter->out[0] == (gdb_wchar_t) 0xfeff) ) {
+
+ /* iconv returned byte order marks, skip those */
+ int mov;
+ for (mov = 0; mov < (num - 1); mov ++)
+ iter->out[mov] = iter->out[mov + 1];
+
+ num -= 1;
+ }
+ }
+
return num;
}

Only in src/gdb: charset.c.~1.24.~