public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* c++ member arrays with variable size
@ 2007-11-04  1:52 D Haley
  2007-11-04  3:10 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: D Haley @ 2007-11-04  1:52 UTC (permalink / raw)
  To: gdb

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 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-11-09  6:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-04  1:52 c++ member arrays with variable size D Haley
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

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