printing 0xbeef wchar_t on x86-windows...

Joel Brobecker
Tue Oct 16 23:31:00 GMT 2012

> Joel>   * valprint.c:generic_emit_char calls wchar_iterate, and finds
> Joel>     one valid character according to the intermediate encoding
> Joel>     ("wchar_t"), even though the character isn't valid in the
> Joel>     original/target charset ("CP1252").

> generic_emit_char should be assuming that the character is in the target
> wide charset, not in the target charset.  That is, "show
> target-wide-charset".
> If the 'encoding' argument to generic_emit_char is "CP1252" then I think
> something went wrong earlier.

OK, small correction: generic_emit_char was called with 'encoding'
set to "UTF-16LE", which makes sense, given that it is what the
windows (actually cygwin) -tdep file explicitly sets it to.

I probably got confused in my notes with what was happening with
GDB 7.5, or maybe just got confused period.

Other than that, I think that the rest remains accurate, so it seem

> And, this call to convert_between_encodings is converting from the
> intermediate charset to the host charset.  So, I think this should be
> sizeof (gdb_wchar_t).

... would be the way to go, assuming that we're not waiting for Keith's
patches. A small request: If Keith's patch is still some ways off, I'd
love to have a fix put in while we wait. This bug, and a few other
charset-related ones, have been nagging at me for a while, and with
more important tasks, traveling and, hum, holidays, I haven't had
the time to follow up as quickly as I'd like...


More information about the Gdb-patches mailing list