Debugging C++ Applications Using HP WDB (766162-001, March 2014)

NOTE: While debugging an application, only those functions of STL which are used at least once
in the application can be called at WDB command line.
Debugging C++11 specific features
Debugging char16_t and char32_t Types
C++11 standard has added new character types, char16_t for 16-bit code units, and char32_t
for 32-bit code units. You can use the ptype command to know the new character types.
Example 24 (page 36) shows a sample program for debugging char16_t and char32_t:
Example 24 Sample program for debugging char16_t and char32_t Types
1 int main()
2 {
3 char16_t c16_1,*s16_1=u"this is char16_t type";
4 char32_t c32_1,*s32_1=U"this is char32_t type";
5
6 class ABC {
7 public:
8 int i;
9 char16_t c16_2,*s16_2;
10 char32_t c32_2,*s32_2;
11 } abc;
12
13 c16_1=*s16_1;
14 c32_1=*s32_1;
15 abc.i = 10;
16
17 return 0;
18 }
The following is the WDB output snippet for this program:
(gdb) b 15
Breakpoint 1 at 0x4000920:1: file my_char_16_32.cc, line 15 from
/user/usr1/my_char_16_32.
(gdb) r
Starting program: /user/usr1/my_char_16_32
Breakpoint 1, main () at my_char_16_32.cc:15
15 abc.i = 10;
(gdb) pt c16_1
type = char16_t
(gdb) pt c32_1
type = char32_t
(gdb) pt abc
type = class ABC {
int i;
char16_t c16_2;
char16_t *s16_2;
char32_t c32_2;
char32_t *s32_2;
}
(gdb) print sizeof(c16_1)
$1 = 2
(gdb) print sizeof(c32_1)
$2 = 4
(gdb) q
36