Bug 79378

Summary: gdb unable to recognize string
Product: [Retired] Red Hat Linux Reporter: Ronald W. Heiby <rhrhgx56>
Component: gdbAssignee: Elena Zannoni <ezannoni>
Status: CLOSED RAWHIDE QA Contact: Jay Turner <jturner>
Severity: medium Docs Contact:
Priority: high    
Version: 8.0CC: srevivo
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-12-10 22:40:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ronald W. Heiby 2002-12-10 22:40:50 UTC
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.

Comment 1 Elena Zannoni 2002-12-10 23:53:45 UTC
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}}