From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29572 invoked by alias); 30 May 2005 16:58:23 -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 29557 invoked by uid 22791); 30 May 2005 16:58:20 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 30 May 2005 16:58:20 +0000 Received: from drow by nevyn.them.org with local (Exim 4.50) id 1Dcnaj-0006GC-C0; Mon, 30 May 2005 12:58:17 -0400 Date: Mon, 30 May 2005 16:58:00 -0000 From: Daniel Jacobowitz To: Vladimir Prus Cc: gdb@sources.redhat.com Subject: Re: printing "variable-sized" registers Message-ID: <20050530165817.GA24005@nevyn.them.org> Mail-Followup-To: Vladimir Prus , gdb@sources.redhat.com 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-SW-Source: 2005-05/txt/msg00367.txt.bz2 On Mon, May 30, 2005 at 06:22:19PM +0400, Vladimir Prus wrote: > > Hello, > I'm working on a gdb port, and have problems with printing certain registers > of my target. The problem is that those registers are vector buffers that > can hold from 0 to 32 values at any given moment. I would like the 'info > registers' command to print exactly the number of values that are present > in a buffer. That is, on one invocation I might get 4 values printed, and > on another 15, depending on the current processor state. > > However, I don't see an easy way to do this. The > 'default_print_registers_info' function uses 'val_print' to print the > value, and 'val_print' uses register type (struct type*), which has a fixed > size. Anything I can do? Or I should just write arch-specific > 'print_registers_info' function? The last one. The best you can do the rest of the time is going to be giving them a type containing the maximum number of values and fill in with dummies - maybe also including the count? If you want "print $reg" to display them nicely, you're going to need to teach GDB's type system about it somehow. I have no idea what that change would look like or how it would work, but it could be generally useful - it's the same concept as prettyprinting a tagged union, I think. -- Daniel Jacobowitz CodeSourcery, LLC