TotalView User Guide : Part II: Debugging Tools and Tasks : Examining and Editing Data and Program Elements : Changing a Variable’s Data Type : Casting Using the Built-In Types : Viewing Wide Character Arrays ($wchar Data Types)
Viewing Wide Character Arrays ($wchar Data Types)
If you create an array of wchar_t wide characters, TotalView automatically changes the type to $wstring[n]; that is, it is displayed as a null-terminated, quoted string with a maximum length of n. For an array of wide characters, the null terminator is L’0’. Similarly, TotalView changes wchar_t* declarations to $wstring* (a pointer to a null-terminated string).
Figure 125: Displaying wchar_t Data
Figure 125 shows the declaration of two wide characters in the Process Window. The Expression List Window shows how TotalView displays their data. The L in the data indicates that TotalView is displaying a wide literal.
Since most wide character arrays represent strings, the $wstring type can be very convenient. But if this isn’t what you want, you can change the $wstring type back to a wchar_t (or wchar[n] or $wchar or $wchar[n]), to display the variable as you declared it.
If the wide character uses from 9 to 16 bits, TotalView displays the character using the following universal-character code representation:
\uXXXX
X represents a hexadecimal digit. If the character uses from 17 to 32 bits, TotalView uses the following representation:
\UXXXXXXXX
*Platforms and compilers differ in the way they represent wchar_t. In consequence, TotalView allows you to see this information in platform-specific ways. For example, you can cast a string to $wstring_s16 or $wstring_s32. In addition, many compilers have problems either using wide characters or handing off information about wide characters so they can be interpreted by any debugger (not just TotalView). For information on supported compilers, see the TotalView Release Notes at http:// www.roguewave.com/support/product-documentation/totalview.aspx.