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]

Re: iconv returning byte order marks for Solaris 2.9


Thanks for the patch. I'm actually generating solaris binaries
using a cross compiler (from a Linux box) and in my current 
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 <tromey@redhat.com> wrote:

> From: Tom Tromey <tromey@redhat.com>
> 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" ==
> Andrew? <ke@alum.bu.edu>
> writes:
> 
> 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.
> 
> Ah, thanks.
> 
> Andrew> But setting INTERMEDIATE_ENCODING to "UCS-4BE"
> eliminated the
> Andrew> BOM in the beginning.
> 
> Great.? Could you try the appended patch?
> I'm testing it on Linux.
> 
> Tom
> 
> 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 @@
> ? ? wrappers for the wchar_t functionality we
> use.? */
>  
>  
> -#define INTERMEDIATE_ENCODING "wchar_t"
> -
>  #if defined (HAVE_ICONV)
>  #include <iconv.h>
>  #else
> @@ -63,6 +61,20 @@ typedef wint_t gdb_wint_t;
>  
>  #define LCST(X) L ## X
>  
> +#ifdef __STDC_ISO_10646__
> +/* On Solaris 9, iconv_open does not accept
> "wchar_t".? So, on this
> +???platform, and other platforms where
> wchar_t is known to use
> +???ISO-10646, choose an appropriate
> explicit charset name.? Also,
> +???UCS-4 on Solaris will emit a BOM, which
> we don't want.? So, we
> +???choose an explicit little- or big-endian
> variant, depending on the
> +???host.? */
> +#if WORDS_BIGENDIAN
> +#define INTERMEDIATE_ENCODING "UCS-4BE"
> +#else
> +#define INTERMEDIATE_ENCODING "UCS-4LE"
> +#endif
> +#endif
> +
>  #else
>  
>  typedef char gdb_wchar_t;
> @@ -87,4 +99,8 @@ typedef int gdb_wint_t;
>  
>  #endif
>  
> +#ifndef INTERMEDIATE_ENCODING
> +#define INTERMEDIATE_ENCODING "wchar_t"
> +#endif
> +
>  #endif /* GDB_WCHAR_H */
> 




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