printing wchar_t*

Mark Kettenis mark.kettenis@xs4all.nl
Fri Apr 14 19:53:00 GMT 2006


> Date: Fri, 14 Apr 2006 10:53:44 -0700
> From: "Jim Blandy" <jimb@red-bean.com>
> 
> I think folks are seeing difficult problems where there aren't any. 
> Even if the host character set (that is, the character set GDB is
> using to communicate with its user, or in its MI communications) is
> plain, old ASCII, GDB can, without any loss of information, convey the
> contents of a wide string using an arbitrary target character set via
> MI to a GUI, using code the GUI must already have.
> 
> Suppose we have a wide string where wchar_t values are Unicode code
> points.  Suppose our host character set is plain ASCII.  Suppose the
> user's program has a string containing the digits '123', followed by
> some funky Tibetan characters U+0F04 U+0FCC, followed by the letters
> 'xyz'.  When asked to print that string, GDB should print the
> following twenty-one ASCII characters:
> 
> L"123\x0f04\x0fccxyz"
> 
> Since this is a valid way to write that string in a source program, a
> user at the GDB command line should understand it.  Since consumers of
> MI information must contain parsers for C values already, they can
> reliably find the contents of the string.

I think this makes an awful lot of sense.

Mark



More information about the Gdb mailing list