473,396 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Debug stringstream with GDB in general

Does anyone know how to debug objects of the type stream in general
using GDB ? I am currently using GDB version 6.4.

There is no much usefull information about it througout the internet.
I am using the tips of the sites below to debug STL containers but I
found nothing about stream.

http://www.yolinux.com/TUTORIALS/GDB....html#STLDEREF

Basically I need to see the contents on a stringstream as the one on
the program below, but I can not use call either print on a
stringstream object.

#include <iostream>
#include <sstream>

using namespace std;

int main ( int argc, char* argv[] ) {

cout << "Starting Processing" << endl;

stringstream l_Str;
l_Str << "foo";

cout << "Process finished" << endl;

return 0;
}

g++ -ggdb -o test test.cpp

gdb ./test

(gdb) break test.cpp:12
(gdb) run

(gdb) call l_Str.str()
Couldn't find method stringstream::str
(gdb) print l_Str.str()
Couldn't find method stringstream::str
(gdb) print l_Str
$1 = <incomplete type>
Jun 27 '08 #1
2 8547
On Apr 29, 6:02 pm, ademirzanetti <ademirzane...@gmail.comwrote:
Does anyone know how to debug objects of the type stream in general
using GDB ? I am currently using GDB version 6.4.

There is no much usefull information about it througout the internet.
I am using the tips of the sites below to debug STL containers but I
found nothing about stream.

http://www.yolinux.com/TUTORIALS/GDB....html#STLDEREF

Basically I need to see the contents on a stringstream as the one on
the program below, but I can not use call either print on a
stringstream object.

#include <iostream>
#include <sstream>

using namespace std;

int main ( int argc, char* argv[] ) {

cout << "Starting Processing" << endl;

stringstream l_Str;
l_Str << "foo";

cout << "Process finished" << endl;

return 0;

}

g++ -ggdb -o test test.cpp

gdb ./test

(gdb) break test.cpp:12
(gdb) run

(gdb) call l_Str.str()
Couldn't find method stringstream::str
(gdb) print l_Str.str()
Couldn't find method stringstream::str
(gdb) print l_Str
$1 = <incomplete type>
Do not know the direct answer but why not try putting a

cout << l_Str.str() << endl;

after the line

l_Str << "foo"
Jun 27 '08 #2
ademirzanetti wrote:
Does anyone know how to debug objects of the type stream in general
using GDB ? I am currently using GDB version 6.4.
Probably, but the best place to find them would be on a gnu/gdb forum,
rather then here.

--
Ian Collins.
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bill Beacom | last post by:
Hi all, I am trying to use stringstream to assemble a text message from a set of user-defined objects that have the insertion operator overloaded. It seems to be putting them into the...
2
by: Woodster | last post by:
I am using std::stringstream to format a string. How can I clear the stringstream variable I am using to "re use" the same variable? Eg: Using std::string std::string buffer; buffer =...
3
by: Mike Chirico | last post by:
Sorry about the newbie question. What's the best way to convert numbers to strings in C++. The following works, but is it better than using the sprintf() "old C" way of converting? #include...
1
by: KidLogik | last post by:
Hello! I am using std::stringstream && std::string to parse a text file -> std::ifstream in; std::string s; std::streamstring ss; int n; I grab each line like so -> std::getline(in,s);
5
by: cherico | last post by:
I'd like to read stings from cin and put them in stringstream. I use a string object as an intermediate "container" to store data from cin and then put them in stringstream. stringstream ss ;...
5
by: William Payne | last post by:
How do you get rid the contents in a std::stringstream? I'm using one in a for loop to format some status messages which I print to the screen. The stringstream member function clear() only clears...
3
by: Thomas Lorenz | last post by:
Hello NG, I'm working on a larger C++ project with it's own debug functionality. The typical debug call looks like this: DEBUG(WARNING, "An error " << getErrorCategory() << " occured."); ...
9
by: Àî°× | last post by:
hi all: I want erase a stringstream' content for input new data to it. example: std::stringstream stm; stm<<"this is a string"; std::cout<<stm.str(); // here print:this is a string
0
by: ziyanjoe | last post by:
Hi! I am writing a program for the robot that runs as a daemon on a linux machine. Since debug output cannot be seen on stdout, I want to create an iostream to handle all the output messages....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.