C99 variable length arrays

Daniel Jacobowitz drow@false.org
Thu Jan 26 15:08:00 GMT 2006


On Thu, Jan 26, 2006 at 08:41:46AM -0500, Igor Khavkine wrote:
> [First posted to bug-gdb@gnu.org, but that list looks rather dead.]
> 
> I'm using GDB to debug some code that uses local variable length
> arrays. This feature is available for C as of the C99 standard. GCC
> has support for it.
> 
> Sadly, GDB doesn't seem to be smart enough to figure out the size of
> the arrays at run time. This leads to things like 'print array[1][2]'
> at the GDB prompt not printing the same value as would 'printf("%g\n",
> array[1][2])' in the code. This is a problem for multidimensional
> arrays especially. Needless to say, this makes the code more difficult
> to debug.

The first thing to do is to write a small testcase, and post the
testcase along with the debugging output that your GCC generates
for it.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb mailing list