From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28417 invoked by alias); 6 Jun 2005 14:05:34 -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 28404 invoked by uid 22791); 6 Jun 2005 14:05:31 -0000 Received: from zigzag.lvk.cs.msu.su (HELO zigzag.lvk.cs.msu.su) (158.250.17.23) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 06 Jun 2005 14:05:31 +0000 Received: from Debian-exim by zigzag.lvk.cs.msu.su with spam-scanned (Exim 4.50) id 1DfIEK-0006YC-9w for gdb@sources.redhat.com; Mon, 06 Jun 2005 18:05:28 +0400 Received: from zigzag.lvk.cs.msu.su ([158.250.17.23]) by zigzag.lvk.cs.msu.su with esmtp (Exim 4.50) id 1DfIEH-0006XG-Uv; Mon, 06 Jun 2005 18:05:25 +0400 From: Vladimir Prus To: Daniel Jacobowitz Subject: Re: printing "variable-sized" registers Date: Mon, 06 Jun 2005 14:05:00 -0000 User-Agent: KMail/1.7.2 Cc: gdb@sources.redhat.com References: <200506061752.08077.ghost@cs.msu.su> <20050606135625.GA27290@nevyn.them.org> In-Reply-To: <20050606135625.GA27290@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506061805.25675.ghost@cs.msu.su> X-SW-Source: 2005-06/txt/msg00048.txt.bz2 On Monday 06 June 2005 17:56, Daniel Jacobowitz wrote: > On Mon, Jun 06, 2005 at 05:52:07PM +0400, Vladimir Prus wrote: > > > 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? > > > > This's what I was doing -- assigning "array of 32 uin64s" type to those > > registers and they are printed with "info all-registers", but the dummy > > values do no look nice when presented to the user. > > Right. You can correct how they're printed in info registers and info > all-registers by providing your own print_registers_info. But that won't help with the "print" command. > > > 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. > > > > Ok, understood. With the attached patch I get what I want, but I have no > > idea if this patch is good or not. > > No, I don't think this is an acceptable way to do it - too inelegant. > I don't know. Well, to teach gdb type system that array can have variable size, we need to pass the size as the part of value. I'm not happy with hardcoded 'unsigned int', but making size type configuration would be a much larger change. Anyway, since this is rather special case, I can live with local patches. - Volodya