Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 79378 - gdb unable to recognize string
Summary: gdb unable to recognize string
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gdb
Version: 8.0
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Elena Zannoni
QA Contact: Jay Turner
Depends On:
TreeView+ depends on / blocked
Reported: 2002-12-10 22:40 UTC by Ronald W. Heiby
Modified: 2015-01-08 00:02 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2002-12-10 22:40:56 UTC

Attachments (Terms of Use)

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}}

Note You need to log in before you can comment on or make changes to this bug.