This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Iconv / Solaris
>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:
Daniel> On Thu, Aug 27, 2009 at 11:00:41AM -0600, Tom Tromey wrote:
>> Alternatively, you could try using the __sun__ variant and running gdb
>> in a non-UTF-8 locale. If it works we could go with (a variant of) this
>> approach.
Daniel> What do we look for? That is, how would I know if it was working or
Daniel> not? I can easily try an ISO-8859-1 locale, but otherwise I'm a bit
Daniel> out of my depth.
Hmm, good question.
For ISO-8859-1, it is tricky, because that is a subset of UCS-4.
I think you could do a test in other ISO-8859 locales: take a narrow
character not appearing in ISO-8859-1, convert it to a wchar_t using
btowc, and then print the value. If the value is the same as the UCS-4
value, you probably have UCS-4 wchar_t.
E.g., in ISO-8859-15, 0xA4 is the euro currency sign. In UCS-4 this is
0x20A0.
The cases I was more concerned about were locales using encodings like
SJIS or EUC. I'm not sure what wchar_t encoding these might use.
So, I dug through the OpenSolaris source a little and I think UCS-4 is
not always used. In particular it looks like mbtowc can call:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libbc/libc/gen/common/euc.multibyte.c#_mbtowc_euc
... which looks like it uses an ad hoc flattened EUC encoding.
The initial problem here is that iconv will not accept "wchar_t" as an
encoding on this platform. I see we only have one AC_TRY_RUN in gdb
... am I right in assuming that these are not ok?
If they are ok, we can test this at configure time.
If they are not ok, I think we can just add a new setting to
configure.host. This is simpler to implement.
Tom