This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: Your INTERMEDIATE_ENCODING patch for Solaris
> -----Message d'origine-----
> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé?: Monday, August 30, 2010 8:01 PM
> À?: Pierre Muller
> Cc?: gdb-patches@sourceware.org
> Objet?: Re: Your INTERMEDIATE_ENCODING patch for Solaris
>
> >>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
>
> Tom> Here's a new version that should disable iconv on this platform,
> among
> Tom> others.
>
> Hi Pierre. Did this patch work for you?
Hi Tom,
sorry for the delay:
here are a few results:
Test machine #1:
uname -a output:
SunOS opensolaris 5.11 snv_111b i86pc i386 i86pc Solaris
With your patch, gdb compiles fine,
gdbcvs/build-norm/gdb$ grep ICONV *.h
config.h:#define HAVE_ICONV 1
config.h:/* #undef HAVE_ICONVLIST */
config.h:/* #undef HAVE_LIBICONVLIST */
config.h:#define ICONV_CONST const
./gdb ./gdb
(top-gdb) p version
$1 = "7.2.50.20100831-cvs"
after replacing \r\n by \r+\n in charset.exp, I get:
.../gdb/testsuite$ gmake check RUNTESTFLAGS=charset.exp
=== gdb Summary ===
# of expected passes 111
# of unexpected failures 50
(Do you want the detailed output?)
(Without patch, but the same modified charset.exp,
the printing of version fails
I get:
=== gdb Summary ===
# of expected passes 74
# of unexpected failures 87
)
Test machine #2:
uname -a output:
uname -a
SunOS muller 5.11 snv_111b sun4v sparc SUNW,Sun-Fire-T200 Solaris
gdb/buildcvs/gdb$ ./gdb ./gdb
(top-gdb) p version
$1 = "7.2.50.20100831-cvs"
(top-gdb) inf func iconv
All functions matching regular expression "iconv":
File ../../src/gdb/charset.c:
size_t phony_iconv(int, const char **, size_t *, char **, size_t *);
int phony_iconv_close(int);
int phony_iconv_open(const char *, const char *);
static void cleanup_iconv(void *);
(top-gdb) q
:/gdb/buildcvs/gdb$ grep ICONV *.h
config.h:/* #undef HAVE_ICONV */
config.h:/* #undef HAVE_ICONVLIST */
config.h:/* #undef HAVE_LIBICONVLIST */
config.h:/* #undef ICONV_CONST */
So apparently on Sparc, the C library iconv is not found,
despite the fact that it is in libc.so:
/lib$ objdump -T libc.so |grep iconv
0005f768 g DF .text 00000034 SUNW_0.8 .protected iconv
0005f6e8 g DF .text 00000080 SUNW_0.8 .protected iconv_close
0005f000 g DF .text 000000b4 SUNW_0.8 .protected iconv_open
After searching, it appears that the problem comes from the fact
that /usr/local/include is searched before /usr/include,
while /usr/local/lib is not searched at all for libraries.
/usr/local/include/iconv.h contains the /usr/local/lib/libiconv.so
header.
Compilation without -liconv fails because
/usr/local/include/iconv.h has:
#define iconv libiconv
but libiconv is not found in c library.
and the second compilation with "-liconv" option fails
because /usr/local/lib is not in the library search path.
Ugly, no?
For that machine, the output did not change as none of the
ICONV macros are set.
Test machine #3 x86_64 prcoessor:
uname -a
SunOS muller 5.11 snv_111b i86pc i386 i86pc Solaris
gdb/build-64/gdb$ grep ICONV *.h
config.h:#define HAVE_ICONV 1
config.h:/* #undef HAVE_ICONVLIST */
config.h:/* #undef HAVE_LIBICONVLIST */
config.h:#define ICONV_CONST const
So this one uses c library iconv.
(top-gdb) p version
$1 = <error reading variable>
(top-gdb) inf fun iconv
All functions matching regular expression "iconv":
File ../../src/gdb/charset.c:
static void cleanup_iconv(void *);
Non-debugging symbols:
0x0000000000514860 iconv_open
0x0000000000514860 iconv_open@plt
0x0000000000514870 iconv_close
0x0000000000514870 iconv_close@plt
0x0000000000514880 iconv
0x0000000000514880 iconv@plt
(top-gdb) set host-charset UTF-8
(top-gdb) p version
$2 = "7.2.50.20100831-cvs"
So here, the c library iconv functions are used,
but the default host-charset is set to ASCII which is
not handled by that iconv :(
So I would like to have the default host and target
charset changed to UTF-8.
It is of course possible to use:
gdb/build-64/gdb$ export LANG=en_US.UTF-8
in that case, the defaults are set correctly:
(top-gdb) p version
$1 = "7.2.50.20100831-cvs"
(top-gdb) show charset
The host character set is "auto; currently UTF-8".
The target character set is "auto; currently UTF-8".
The target wide character set is "auto; currently UTF-32".
But I would still prefer if we changed also the default
to UTF-8 for solaris.
Pierre