From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10556 invoked by alias); 26 Jan 2006 13:49:30 -0000 Received: (qmail 10547 invoked by uid 22791); 26 Jan 2006 13:49:29 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Thu, 26 Jan 2006 13:49:28 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1F27V8-0000v0-MH; Thu, 26 Jan 2006 08:49:26 -0500 Date: Thu, 26 Jan 2006 15:08:00 -0000 From: Daniel Jacobowitz To: Igor Khavkine Cc: gdb@sourceware.org Subject: Re: C99 variable length arrays Message-ID: <20060126134926.GA3501@nevyn.them.org> Mail-Followup-To: Igor Khavkine , gdb@sourceware.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-IsSubscribed: yes 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/msg00264.txt.bz2 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