From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 934 invoked by alias); 26 Aug 2010 11:41:36 -0000 Received: (qmail 922 invoked by uid 22791); 26 Aug 2010 11:41:35 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=BAYES_05,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-pw0-f41.google.com (HELO mail-pw0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Aug 2010 11:41:31 +0000 Received: by pwj6 with SMTP id 6so800554pwj.0 for ; Thu, 26 Aug 2010 04:41:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.48.1 with SMTP id v1mr6575673wfv.195.1282822889846; Thu, 26 Aug 2010 04:41:29 -0700 (PDT) Received: by 10.142.162.9 with HTTP; Thu, 26 Aug 2010 04:41:29 -0700 (PDT) Date: Thu, 26 Aug 2010 11:41:00 -0000 Message-ID: Subject: gdb breaking down at printing variable From: Vikas Mishra To: gdb@sourceware.org Cc: Vikas Mishra Content-Type: multipart/mixed; boundary=000e0cd215b6a8b9ff048eb87acf Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00152.txt.bz2 --000e0cd215b6a8b9ff048eb87acf Content-Type: text/plain; charset=ISO-8859-1 Content-length: 1009 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 --000e0cd215b6a8b9ff048eb87acf Content-Type: application/octet-stream; name="split.cc" Content-Disposition: attachment; filename="split.cc" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gdbjjfts0 Content-length: 1416 I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNjdHlwZT4KI2luY2x1ZGU8 c3RyaW5nPgojaW5jbHVkZTx2ZWN0b3I+Cgp1c2luZyBzdGQ6OmNvdXQ7CnVz aW5nIHN0ZDo6dmVjdG9yOwp1c2luZyBzdGQ6OnN0cmluZzsKdXNpbmcgc3Rk OjplbmRsOwp1c2luZyBzdGQ6Omlzc3BhY2U7Cgp2ZWN0b3I8c3RyaW5nPiBz cGxpdChjb25zdCBzdHJpbmcmIHMpOwoKCmludCBtYWluKCkKewoJc3RyaW5n IGlucHV0X3N0cmluZyA9ICJnZGIgYnJlYWtzIG9uIHRoaXMgcHJvZ3JhbS4g IjsgCgl2ZWN0b3I8c3RyaW5nPiBsaXN0X29mX3dvcmRzOwoKCWxpc3Rfb2Zf d29yZHMgPSBzcGxpdChpbnB1dF9zdHJpbmcpOwoKCS8vIHByZXBhcmUgZm9y IHByaW50aW5nIHRoZSB2ZWN0b3IKCXN0ZDo6dmVjdG9yPHN0cmluZz46OnNp emVfdHlwZSBpID0gMDsKCXdoaWxlIChpICE9IGxpc3Rfb2Zfd29yZHMuc2l6 ZSgpKSB7CgkJY291dCA8PCBsaXN0X29mX3dvcmRzW2ldIDw8IGVuZGw7CgkJ aSsrOwoJfQoJcmV0dXJuIDE7Cn0KCnZlY3RvcjxzdHJpbmc+IHNwbGl0KGNv bnN0IHN0cmluZyYgcykKewoJdmVjdG9yPHN0cmluZz4gcmV0OwoJdHlwZWRl ZiB2ZWN0b3I8c3RyaW5nPjo6c2l6ZV90eXBlIHN0cmluZ19zaXplOwoKCXN0 cmluZ19zaXpl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