Description of Problem: I create a test file, foo.cpp: ----- Cut here ----- #include <string> using std::string; main() { string rwh; rwh = "acme"; } ----- Cut here ----- I invoke the compiler: g++ -g foo.cpp -o foo I invoke the debugger: gdb foo and enter commands: (gdb) break main (gdb) r [hit the breakpoint] (gdb) p rwh $1 = { static npos = Cannot access memory at address 0x833b550 (gdb) n (gdb) p rwh [same error] (gdb) n (gdb) p rwh [same error] The memory is obviously accessible, since the assignment did not cause an exception or fault. Looks like gdb is powerfully confused. Version-Release number of selected component (if applicable): The compiler (with -v) says it's RH 8.0 3.2-7. gdb is 5.2.1-4. How Reproducible: every time Expected Results: Expected to see an indication that the string contained "acme" after the assignment. Expected not to see a bogus error message before the assignment.
Namespace support is currently being worked on in the FSF tree, there will be a fix for this testcase in the next rawhide distro. Starting program: ~/79378 Breakpoint 1, main () at 79378.cpp:6 6 string rwh; (gdb) p rwh $2 = {static npos = 4294967295, _M_dataplus = {<allocator<char>> = {<No data fields>}, _M_p = 0x421248d8 "\004"}, static _S_empty_rep_storage = {0, 0, 0, 0}} (gdb) n 8 rwh = "acme"; (gdb) p rwh $3 = {static npos = 4294967295, _M_dataplus = {<allocator<char>> = {<No data fields>}, _M_p = 0x400e89ac ""}, static _S_empty_rep_storage = {0, 0, 1, 0}} (gdb) n 9 } (gdb) p rwh $4 = {static npos = 4294967295, _M_dataplus = {<allocator<char>> = {<No data fields>}, _M_p = 0x80497ac "acme"}, static _S_empty_rep_storage = {0, 0, 0, 0}}