public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: D Haley <mycae@yahoo.com>
To: gdb@sourceware.org
Subject: c++ member arrays with variable size
Date: Sun, 04 Nov 2007 01:52:00 -0000	[thread overview]
Message-ID: <460780.34754.qm@web36815.mail.mud.yahoo.com> (raw)

Hello,

I recently was doing some debugging, and came across
something new (to me). When debugging routines with
arrays that are declared with variable bounds i found
that GDB is not able to "see" them.

For example

#include <iostream>

void foo(unsigned int size);

int main()
{
	foo(3);
}

void foo(unsigned int size)
{
	char bar[size];
	int i=1;
	
	if(!size)
		return;

	std::cerr << bar[0] << std::endl;
}

upon placing a breakpoint on the std::cerr line, and
using "info locals" GDB wont show up the bar variable,
nor does trying to print bar work, it claims its not a
variable 'no symbol "bar" in current context'

Is it possible to identify these in GDB, or
alternatively how else can I view these arrays in the
debugger, short of rewriting it?

Thanks.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

             reply	other threads:[~2007-11-04  1:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-04  1:52 D Haley [this message]
2007-11-04  3:10 ` Daniel Jacobowitz
2007-11-04 11:26   ` D Haley
2007-11-04 14:34     ` Daniel Jacobowitz
2007-11-05 18:55       ` Jim Ingham
2007-11-09  6:42         ` D Haley

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=460780.34754.qm@web36815.mail.mud.yahoo.com \
    --to=mycae@yahoo.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).