🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1203

C99 variable length arrays

#1203
From: Igor Khavkine
Date: Wed, 25 Jan 2006 23:27
36 lines
3671 bytes
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
Technical Details
Message-ID: <mailman.165.1138247568.2878.bug-gdb@gnu.org>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f5053,e96e2d7e01c53454,start
X-Google-Attributes: gidf5053,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail
From: Igor Khavkine <igor.kh@gmail.com>
Newsgroups: gnu.gdb.bug
Subject: C99 variable length arrays
Date: Wed, 25 Jan 2006 18:27:00 -0500
Lines: 38
Approved: bug-gdb@gnu.org
Message-ID: <mailman.165.1138247568.2878.bug-gdb@gnu.org>
NNTP-Posting-Host: lists.gnu.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: news.Stanford.EDU 1138247397 22206 199.232.76.165 (26 Jan 2006 03:49:57 GMT)
X-Complaints-To: news@news.stanford.edu
To: bug-gdb@gnu.org
Envelope-to: bug-gdb@gnu.org
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
 h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition;
 b=uXxyv7OZd9/IrwWpVBapZ0ijPlS8DdooesidAEN35pGPG39NxQYaK1vjUdsvaKoZ4We2j3+AigVd7RaT3aB05s9H7TXwNNqmT+PdzVPdL5GfhpsYw8O6B9X2MqVMvFI8tDyXJ59OXgyhPDFVRVOTkpAZfiBbwlW8VSERn2IJAGo=
Content-Disposition: inline
X-Mailman-Approved-At: Wed, 25 Jan 2006 22:52:46 -0500
X-BeenThere: bug-gdb@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Bug reports for GDB, the GNU debugger" <bug-gdb.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/bug-gdb>
List-Post: <mailto:bug-gdb@gnu.org>
List-Help: <mailto:bug-gdb-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=subscribe>