From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1327 invoked by alias); 21 Jul 2009 18:55:44 -0000 Received: (qmail 1317 invoked by uid 22791); 21 Jul 2009 18:55:44 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from web33807.mail.mud.yahoo.com (HELO web33807.mail.mud.yahoo.com) (209.191.69.170) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Tue, 21 Jul 2009 18:55:37 +0000 Received: (qmail 59221 invoked by uid 60001); 21 Jul 2009 18:55:35 -0000 Message-ID: <346309.57700.qm@web33807.mail.mud.yahoo.com> Received: from [128.222.37.53] by web33807.mail.mud.yahoo.com via HTTP; Tue, 21 Jul 2009 11:55:35 PDT X-RocketYMMF: andywang621 Date: Tue, 21 Jul 2009 20:18:00 -0000 From: Andrew Reply-To: ke@alum.bu.edu Subject: Re: iconv returning byte order marks for Solaris 2.9 To: gdb-patches@sourceware.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2009-07/txt/msg00523.txt.bz2 Thanks for the patch. I'm actually generating solaris binaries using a cross compiler (from a Linux box) and in my current=20 configuration it doesn't work. __STDC_ISO_10646__ is not defined. I will try installing gcc locally and see how that works. Andrew --- On Fri, 7/17/09, Tom Tromey wrote: > From: Tom Tromey > Subject: Re: iconv returning byte order marks for Solaris 2.9 > To: ke@alum.bu.edu > Cc: gdb-patches@sourceware.org > Date: Friday, July 17, 2009, 3:02 PM > >>>>> "Andrew" =3D=3D > Andrew=A0 > writes: >=20 > Andrew> In the system I'm working iconv_open doesn't > accept "wchar_t" as > Andrew> encoding name. It failed when > INTERMEDIATE_ENCODING was set to > Andrew> that. >=20 > Ah, thanks. >=20 > Andrew> But setting INTERMEDIATE_ENCODING to "UCS-4BE" > eliminated the > Andrew> BOM in the beginning. >=20 > Great.=A0 Could you try the appended patch? > I'm testing it on Linux. >=20 > Tom >=20 > diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h > index 07a6c87..241e051 100644 > --- a/gdb/gdb_wchar.h > +++ b/gdb/gdb_wchar.h > @@ -35,8 +35,6 @@ > =A0 =A0 wrappers for the wchar_t functionality we > use.=A0 */ >=20=20 >=20=20 > -#define INTERMEDIATE_ENCODING "wchar_t" > - > #if defined (HAVE_ICONV) > #include > #else > @@ -63,6 +61,20 @@ typedef wint_t gdb_wint_t; >=20=20 > #define LCST(X) L ## X >=20=20 > +#ifdef __STDC_ISO_10646__ > +/* On Solaris 9, iconv_open does not accept > "wchar_t".=A0 So, on this > +=A0=A0=A0platform, and other platforms where > wchar_t is known to use > +=A0=A0=A0ISO-10646, choose an appropriate > explicit charset name.=A0 Also, > +=A0=A0=A0UCS-4 on Solaris will emit a BOM, which > we don't want.=A0 So, we > +=A0=A0=A0choose an explicit little- or big-endian > variant, depending on the > +=A0=A0=A0host.=A0 */ > +#if WORDS_BIGENDIAN > +#define INTERMEDIATE_ENCODING "UCS-4BE" > +#else > +#define INTERMEDIATE_ENCODING "UCS-4LE" > +#endif > +#endif > + > #else >=20=20 > typedef char gdb_wchar_t; > @@ -87,4 +99,8 @@ typedef int gdb_wint_t; >=20=20 > #endif >=20=20 > +#ifndef INTERMEDIATE_ENCODING > +#define INTERMEDIATE_ENCODING "wchar_t" > +#endif > + > #endif /* GDB_WCHAR_H */ >=20