From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6403 invoked by alias); 26 Jan 2006 13:41:51 -0000 Received: (qmail 6394 invoked by uid 22791); 26 Jan 2006 13:41:50 -0000 X-Spam-Check-By: sourceware.org Received: from xproxy.gmail.com (HELO xproxy.gmail.com) (66.249.82.202) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 26 Jan 2006 13:41:48 +0000 Received: by xproxy.gmail.com with SMTP id t11so222617wxc for ; Thu, 26 Jan 2006 05:41:46 -0800 (PST) Received: by 10.70.95.17 with SMTP id s17mr679796wxb; Thu, 26 Jan 2006 05:41:46 -0800 (PST) Received: by 10.70.75.18 with HTTP; Thu, 26 Jan 2006 05:41:46 -0800 (PST) Message-ID: Date: Thu, 26 Jan 2006 13:49:00 -0000 From: Igor Khavkine To: gdb@sourceware.org Subject: C99 variable length arrays MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-01/txt/msg00263.txt.bz2 [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=3Dview&pr=3D1796