gdb breaking down at printing variable

Vikas Mishra vikasm@vikasmishra.org
Thu Aug 26 11:41:00 GMT 2010


Hello Folks,

I am new to C++ but have used gdb in the past. I am using the python
pretty print extensions to the GDB to print STL containers. I wanted
to check with the mailing list about an issue that I was seeing
recently.  I am seeing the issue both on Cygwin as well as in Linux.

Problem : Unable to print a vector during debugging.

How to reproduce it : I have attached a program which has two
functions - main and split, It is a very simple program that takes a
string and splits it into words (like Perl's split function). I am not
able to print the variable "ret" anywhere in the "split" function.

What is observed : Error seen is "virtual memory exahusted: can't
allocate xxxx bytes".

If I try to print "list_of_words" anywhere in the main function, it is
behaving as expected.

Version used : g++ 4.3.4 / gdb 7.1 (Cygwin). ; g++(4.5.1) / gdb-cvs (Linux)

Could someone let me know what is the issue here. Am I missing
something basic in which case could someone point me to it.

Regards,
Vikas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: split.cc
Type: application/octet-stream
Size: 1044 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb/attachments/20100826/1f0fc15b/attachment.obj>


More information about the Gdb mailing list