bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C99 variable length arrays


From: Igor Khavkine
Subject: C99 variable length arrays
Date: Wed, 25 Jan 2006 18:27:00 -0500

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%20audit-trail&database=gdb&pr=1796&return_url=http%3A%2F%2Fsources.redhat.com%2Fcgi-bin%2Fgnatsweb.pl%3Fdatabase%3Dgdb%26cmd%3Dsubmit%2520query%26category%3Dall%26severity%3Dall%26priority%3Dall%26responsible%3Dall%26submitter_id%3Dall%26state%3Dall%26ignoreclosed%3DIgnore%2520Closed%26class%3Dall%26synopsis%3Dvariable%2520length%26multitext%3D%26columns%3Dcategory%26columns%3Dstate%26columns%3Dclass%26columns%3Dresponsible%26columns%3Dsynopsis%26displaydate%3DDisplay%2520Current%2520Date%26sortby%3DResponsible%26.cgifields%3Ddisplaydate%26.cgifields%3Dignoreclosed%26.cgifields%3Doriginatedbyme%26.cgifields%3Dcolumns




reply via email to

[Prev in Thread] Current Thread [Next in Thread]