This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
c++ member arrays with variable size
- From: D Haley <mycae at yahoo dot com>
- To: gdb at sourceware dot org
- Date: Sat, 3 Nov 2007 18:52:51 -0700 (PDT)
- Subject: c++ member arrays with variable size
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