Bug 79378 - gdb unable to recognize string
gdb unable to recognize string
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gdb (Show other bugs)
8.0
i686 Linux
high Severity medium
: ---
: ---
Assigned To: Elena Zannoni
Jay Turner
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-12-10 17:40 EST by Ronald W. Heiby
Modified: 2015-01-07 19:02 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-12-10 17:40:56 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ronald W. Heiby 2002-12-10 17:40:50 EST
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 18:53:45 EST
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.