Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "André Pönitz" <andre.poenitz@nokia.com>
To: gdb@sourceware.org
Subject: Re: gdb breaking down at printing variable
Date: Thu, 26 Aug 2010 12:25:00 -0000	[thread overview]
Message-ID: <201008261425.21062.andre.poenitz@nokia.com> (raw)
In-Reply-To: <AANLkTikOMH8JmwpDMNj2M2-4eK5Pq3+Vc8BGk0Pxk84y@mail.gmail.com>

On Thursday 26 August 2010 13:41:29 ext Vikas Mishra wrote:
> 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.

This is most likely http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44731 
i.e. not gdb's fault.

> 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.

This a consequence of above (gdb trying to read data from a wrong
location, triggered by the faulty debug information) but I am pretty
sure it can be triggered independently by uninitialized or corrupted
data in the "real" vector object containing the same "noise".

You should be able to verify that by creating such an object and
purposely corrupt it by overwriting it with the data you currently
get with, say,  p {char[12]}&ret.

Andre'


  reply	other threads:[~2010-08-26 12:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-26 11:41 Vikas Mishra
2010-08-26 12:25 ` André Pönitz [this message]
2010-08-26 20:55   ` Tom Tromey
2010-08-27  9:41     ` André Pönitz
2010-08-27 15:22       ` Tom Tromey
     [not found] <AANLkTimFU22phqb1uScS7PZ5WGJ65+1uD6RtkWMt352h@mail.gmail.com>
2010-08-26 15:21 ` Vikas Mishra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201008261425.21062.andre.poenitz@nokia.com \
    --to=andre.poenitz@nokia.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox