Re: printing wchar_t*

Eli Zaretskii
2006-04-13T16:15:37Z

> From: Vladimir Prus <ghost@cs.msu.su>
> Date: Thu, 13 Apr 2006 20:04:32 +0400
>
> at the moment, gdb seem to provide no support for printing wchar_t* values.
> It prints them like this:
>
> (gdb) print p15
> print p15
> $486 = (wchar_t *) 0x80489f8
>
> Is there any "standard" way to make gdb automatically traverse wchar_t*,
> printing values, and stopping at '0' value.

What character set is used by the wide characters in the wchar_t
arrays? GDB has some support for a few single-byte character sets,
see the node "Character Sets" in the manual.

> I have a user-defined command that can produce the output I want, but is
> defining a custom command the right approach?

It's one possibility, the other one being to call a function in the
debuggee to produce the string. Yet another possibility is to do the
conversion in your GUI front end.