This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C99 variable length arrays


[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 GDB bug database has PR 1796 [1] dedicated to this exact issue.
However, the report is over a year old and I couldn't find any work
done on it. If this problem is easy to fix for some GDB hacker, I hope
this email brings it to their attention. If not, and no-one else has
the time to look into it, I'm getting sufficiently annoyed by the bug
to try my own hand at fixing it. Unfortunately, I'm completely
unfamiliar with the internals of GDB and am not sure where to look in
the GDB source code or the debugging info generated by GCC. Any
pointers (no pun intended :-) would be appreciated.

Thanks in advance.

Igor

[1] http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=1796


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]