This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/11233] New: GDB fails to print value for ostringstream object
- From: "jameskyle at ucla dot edu" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 28 Jan 2010 18:30:42 -0000
- Subject: [Bug c++/11233] New: GDB fails to print value for ostringstream object
- Reply-to: sourceware-bugzilla at sourceware dot org
When attempting to print the value of an ostringstream object, gdb returns "could not find method" errors.
This behavior was observed in both v6.3 and v6.8 on Mac OSX 10.6 and on Fedora kernel 2.6.18-128. Both 64bit.
Below is an example program and gdb output when attempting to print the ostringsream methods:
#include <sstream>
#include <iostream>
using namespace std;
int main (int argc, char const *argv[])
{
ostringstream os;
os << "time be time";
cout << os.str() << endl;
cout << os.str().size() << endl;
int foo = 24;
cout << foo << endl;
return 0;
}
/*
=======fedora=============
Starting program: ./bingcc/a.out
Reading symbols for shared libraries ++. done
Breakpoint 1, main (argc=1, argv=0x7fff5fbfe850) at temp2.cpp:10
10 os << "time be time";
(gdb) n
12 int foo = 24;
(gdb) p os.str().size()
Cannot access memory at address 0x0
(gdb) p os.str()
Cannot access memory at address 0x0
=======osx 10.6============
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ... done
(gdb) b 10
Breakpoint 1 at 0x100000c15: file temp2.cpp, line 10.
(gdb) b 13
Breakpoint 2 at 0x100000c2f: file temp2.cpp, line 13.
(gdb) r
Starting program: /Volumes/Groups/Technical/Projects/jkyle/rtmrienv/src/bingcc/a.out
Reading symbols for shared libraries ++. done
Breakpoint 1, main (argc=1, argv=0x7fff5fbfe850) at temp2.cpp:10
10 os << "time be time";
(gdb) n
12 int foo = 24;
(gdb) p os.str().size()
Cannot access memory at address 0x0
(gdb) p os.str()
Cannot access memory at address 0x0
(gdb) p (std::string *)os.str()
A syntax error in expression, near `)os.str()'.
(gdb) p (string)os.str()
No symbol "string" in current context.
(gdb) p (std::string)os.str()
A syntax error in expression, near `os.str()'.
*/
--
Summary: GDB fails to print value for ostringstream object
Product: gdb
Version: 6.8
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at sourceware dot org
ReportedBy: jameskyle at ucla dot edu
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=11233
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.