RE: Your INTERMEDIATE_ENCODING patch for Solaris

Pierre Muller
2010-08-18T11:52:21Z

I can confirm that on a 32-bit i386 OpenSolaris 2.11,
the current CVS tree has the ICONV problem, which is solved by this patch.
Thus I fully support your patch, with a small modification required
for PHONY_ICONV, see below.

The easiest way to see the difference is
(gdbcvs is the executable generated by current CVS HEAD,
gdb is the patched executable).

With:
./gdbcvs ./gdb
.....
(top-gdb) p version
$1 = <error reading variable>
While with:
./gdb ./gdb
.....
(top-gdb) p version
$1 = "7.2.50.20100818-cvs"

I do have other problems with the x86_64 and sparc OpenSolaris versions
I tried to compile, but those are not directly related to the ICONV issue
(at least not only!).

For the x86_64, I had two linking problems:
1) gcc claims that it doesn't know -rdynamic option
gcc --version returns this:
gcc (GCC) 3.4.3 (csl-sol210-3_4-20050802)

"gcc --print-prog-name=ld" returned "/usr/ccs/bin/ld"

and "`gcc --print-prog-name=ld` --version" returned:
ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1689

The compilation was done using the 5 lines long script:
#!/usr/bin/env bash
mkdir build64
cd build64
../src/configure --build=x86_64-pc-solaris2.11 --disable-gdbtk CFLAGS="-g -O0 -m64"
make all-gdb

2) gdb_curses.h was loading ncurses/ncurses.h header,
but the library was /lib/64/libcurses.so.1, not a ncurses library.

This led to unresolved symbols waddr_on/waddr_off (coming from
macro definitions waddron and waddroff inside "ncurses/ncurses.h" header).
(I finally found the origin of that problem:
I installed libiconv from BlastWave into /opt/csw directory,
but this directory was not searched for libraries..).

Manually disabling the
#define HAVE_NCURSES_NCURSES_H 1
line in config.h
allowed to complete the compilation successfully.
I don't know if this is just an installation problem
on my side or a more general issue.

Here the generated debugger did not show the
ICONV problem, as no iconv function was found.

After application of your patch however, I get this:
gcc -g -O0 -m64 -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/con
fig -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/..
/include/opcode -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I.
./bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../.
./src/gdb/../libdecnumber -I../../src/gdb/gnulib -Ignulib -DMI_OUT=1 -DTUI=1
-I/usr/include -I/usr/include -Wall -Wdeclaration-after-statement -Wpointer-ari
th -Wformat-nonliteral -Wno-unused -Wunused-value -Wunused-function -Wno-switch
-Wno-char-subscripts -Werror -c -o charset.o -MT charset.o -MMD -MP -MF .deps/ch
arset.Tpo ../../src/gdb/charset.c
../../src/gdb/charset.c: In function `make_wchar_iterator':
../../src/gdb/charset.c:585: error: `INTERMEDIATE_ENCODING' undeclared (first us
e in this function)
../../src/gdb/charset.c:585: error: (Each undeclared identifier is reported only
once
../../src/gdb/charset.c:585: error: for each function it appears in.)
make: *** [charset.o] Error 1

This is because there is an error in your patch:
if PHONY_ICONV is defined, INTERMEDIATE_ENCODING is not set at all
anymore.
Removing the
#ifndef PHONY_ICONV
around INTERMEDIATE_ENCODING definition
in the bottom of gdb_wchar.h file fixes that issue.

I still needed to disable HAVE_NUCURSES_NCURSES_H to be able
to compile GDB.

I will try to use CSW libiconv to see what happens then.

Pierre Muller
Pascal language support maintainer for GDB