From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21129 invoked by alias); 2 Dec 2003 20:57:56 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 21120 invoked from network); 2 Dec 2003 20:57:55 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 2 Dec 2003 20:57:55 -0000 Received: from drow by nevyn.them.org with local (Exim 4.24 #1 (Debian)) id 1ARHal-0003r7-CV; Tue, 02 Dec 2003 15:57:55 -0500 Date: Tue, 02 Dec 2003 20:57:00 -0000 From: Daniel Jacobowitz To: Mihai Basa Cc: gdb@sources.redhat.com Subject: Re: Array-of-structures slices Message-ID: <20031202205755.GA14777@nevyn.them.org> Mail-Followup-To: Mihai Basa , gdb@sources.redhat.com References: <3FCC10B6@bodkin.nuigalway.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3FCC10B6@bodkin.nuigalway.ie> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-12/txt/msg00027.txt.bz2 On Tue, Dec 02, 2003 at 08:57:19PM +0000, Mihai Basa wrote: > Hello, > > > GDB can "display" values from a slice of an array (using the @ operator) - IF > that array is made up of base datatypes. It cannot plot slices if the array is > made of structures, and I believe it would be really useful if it could... > > As an example, assume we have an array A[100] made up of structures like this: > typedef struct { > int x; > int y; > }; > > I think it would be good if GDB could print/display the string of 100 A.x 'es. > The syntax describing this might be something like: > > display (A[0]@100).x > > which currently just displays A[0].x. This means reading an array of 100 > elements, starting from A[0] with a stride equal to sizeof(A[0]). Currently > GDB can only read with a stride of sizeof(x), if we were to say (A[0].x)@100, > which reads alternating x'es and y'es. > > If this were possible quick visual comparison of a string of related variables > stored in structures could be made. Another reason why I see this as useful is > because if this were possible one could use the DDD front-end to plot > in-program results, even from structures. Yes, I've often wanted the same thing. However, it's quite tricky to implement. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer