From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6267 invoked by alias); 18 Oct 2010 12:14:14 -0000 Received: (qmail 6255 invoked by uid 22791); 18 Oct 2010 12:14:13 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 Oct 2010 12:14:07 +0000 Received: (qmail 22625 invoked from network); 18 Oct 2010 12:14:04 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 18 Oct 2010 12:14:04 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [RFA] valprint.c / *-valprint.c: Don't lose `embedded_offset' Date: Mon, 18 Oct 2010 12:14:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.33-29-realtime; KDE/4.4.2; x86_64; ; ) Cc: Tom Tromey , Joel Brobecker References: <201010070207.02695.pedro@codesourcery.com> <201010072025.07762.pedro@codesourcery.com> In-Reply-To: <201010072025.07762.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010181314.00657.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-10/txt/msg00284.txt.bz2 On Thursday 07 October 2010 20:25:07, Pedro Alves wrote: > > I think we should just get rid of val_print entirely, and only have > > value_print, passing around values. If that is not efficient enough > > (too much copying or something), we can change struct value to make it > > efficient. > > > > What do you think of that? > > Should be possible. Actually, I did go one step further, because it > occured to me that I might as well add an assertion to val_print that > valaddr is in fact always equal to value->contents. See patch below > that applies on top of yesterday's. I don't know why that didn't occur > to me sooner. :-) This passes regression testing as well. > > So, the steps I guess would be: > > - apply yesterday's and this patch. > > - add an assertion to val_print forbidding a NULL struct value, and > fix all callers to make sure to construct a value. Not sure how > many there are, might not be that many. I now that "info reg" is > one case. Just FYI, found out that it made my life easier to do this step as well. I also added a bunch of "valaddr == value->contents" assertions throughout all of *-valprint.c. There weren't that many cases that needed fixing. > - get rid of valaddr and address from all the val_print methods, > getting at the contents of the passed in value instead. It's also > nice to get rid of the `address' parameter, because not all values > actually have a notion of value. Currently, passing around an > address is an abstraction violation. > > - investigate whether passing an offset around is cool, or whether > we need something like a new value type that provides a view into > another value, and pass that around instead? -- Pedro Alves