For some reason, GDB probably does not have debugging information for the STL. Using the above Russian example with g ++ (GCC) 4.3.4 20090804 (release) 1 and GNU gdb 6.8.0.20080328-cvs (cygwin-special), I get the following output
(gdb) p str $1 = {static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {< No data fields>}, <No data fields>}, _M_p = 0x28cce8 "$▒▒"}}
What is the interpretation of raw data fields in std::string . To get the actual string data, I have to reinterpret the _M_p field as a pointer:
(gdb) p *(char**)str._M_dataplus._M_p $2 = 0xd4a224 "random"
Adam rosenfield
source share