RE: Your INTERMEDIATE_ENCODING patch for Solaris

Pierre Muller
2010-09-01T07:30:37Z

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : Tuesday, August 31, 2010 6:47 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: Your INTERMEDIATE_ENCODING patch for Solaris
>
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
> writes:
>
> Pierre> After searching, it appears that the problem comes from the
> fact
> Pierre> that /usr/local/include is searched before /usr/include,
> Pierre> while /usr/local/lib is not searched at all for libraries.
>
> Yuck.
>
> This setup seems unfortunate but I don't think there is much gdb should
> do about it.

I agree with you here :(

> Pierre> Test machine #3 x86_64 prcoessor:
> [...]
> Pierre> So this one uses c library iconv.
> Pierre> (top-gdb) p version
> Pierre> $1 = <error reading variable>
> Pierre> (top-gdb) inf fun iconv
> Pierre> All functions matching regular expression "iconv":
>
> Pierre> So here, the c library iconv functions are used,
> Pierre> but the default host-charset is set to ASCII which is
> Pierre> not handled by that iconv :(
>
> I am not sure how this happens with the patch I posted.
> Does this machine define __STDC_ISO_10646__?
> Or did I somehow get the #if logic wrong?

> Pierre> So I would like to have the default host and target
> Pierre> charset changed to UTF-8.
>
> What does nl_langinfo(CODESET) return on this sytem?
> If you remove the special "646" case, does it work?

the ASCII charset is indeed set by the check to
"646".

If I replace this by (only the "646" specific change is listed):
Index: charset.c
===================================================================
RCS file: /cvs/src/src/gdb/charset.c,v
retrieving revision 1.34
diff -u -p -r1.34 charset.c
--- charset.c 24 Jun 2010 18:24:03 -0000 1.34
+++ charset.c 1 Sep 2010 07:28:23 -0000
@@ -928,7 +931,9 @@ _initialize_charset (void)
/* Solaris will return `646' here -- but the Solaris iconv then
does not accept this. Darwin (and maybe FreeBSD) may return "" here,
which GNU libiconv doesn't like (infinite loop). */
- if (!strcmp (auto_host_charset_name, "646") || !*auto_host_charset_name)
+ if (!strcmp (auto_host_charset_name, "646"))
+ auto_host_charset_name = "UTF-8";
+ else if (!*auto_host_charset_name)
auto_host_charset_name = "ASCII";
auto_target_charset_name = auto_host_charset_name;
#elif defined (USE_WIN32API)

I do get a default of '"UTF-8" for Open Solaris machines,
but I don't know if other systems might also return "646",
but not like the "UTF-8" choice.

In any case, having a LANG environment variable set to xx_XX.UTF-8
also allows to get a nicely working gdb.

Pierre