This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: printing wchar_t*

Eli Zaretskii wrote:

>> From:  Vladimir Prus <>
>> 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.

Relatively safe bet would be to assume it's some zero-terminated character
set. I plan to assume it's either UTF-16 or UTF-32 in the GUI (the
conversion code is the same for both encodings), but gdb can just print raw

>> 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. 

And what such a function will return? char* in local 8-bit encoding? In that
case, no all wchar_t* variable can be printed.

> Yet another possibility is to do the 
> conversion in your GUI front end.

That's what I'm going to do, but first I need to get raw data, preferrably
without issing an MI command for every single character.

- Volodya

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]