From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23659 invoked by alias); 25 Oct 2011 20:49:56 -0000 Received: (qmail 23651 invoked by uid 22791); 25 Oct 2011 20:49:55 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Oct 2011 20:49:41 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RInwK-0000vG-NW from pedro_alves@mentor.com ; Tue, 25 Oct 2011 13:49:40 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 25 Oct 2011 21:49:38 +0100 From: Pedro Alves To: Joel Brobecker Subject: Re: [RFA/RFC] Restore old handling of multi-register variables Date: Tue, 25 Oct 2011 21:09:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.1; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <1317675787-7351-1-git-send-email-brobecker@adacore.com> <201110252002.38708.pedro@codesourcery.com> <20111025203022.GQ19246@adacore.com> In-Reply-To: <20111025203022.GQ19246@adacore.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201110252149.34078.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: 2011-10/txt/msg00686.txt.bz2 On Tuesday 25 October 2011 21:30:22, Joel Brobecker wrote: > Hi Pedro, > > Thanks for the review. One question: > > > > +/* VALUE must be an lval_register value. If regnum is the value's > > > + associated register number, and len the length of the values type, > > > + read one or more registers in FRAME, starting with register REGNUM, > > > + until we've read LEN bytes. */ > > > + > > > +void > > > +read_frame_register_value (struct value *value, struct frame_info *frame) > > > > I think this should be in frame.c instead. value.c is for core > > struct value stuff. > > That's what I thought originally too. The reason why I didn't put > that function there is because I thought that the only way to access > some of the fields was by using the deprecated_[...]_hack functions. > So I thought we weren't supposed to be able to access those components > of a struct value. But looking closer, I think I get the reason why > it's called a hack and deprecated - it's to allow the previous usage > of using the VALUE_something macros to change the value of the > associated component. So I'm assuming that... > > regnum = VALUE_REGNUM (val) > > ... is OK. While... > > VALUE_REGNUM (val) = regnum > > ... is definitely frowned upon. Correct. Ideally we'd replace those hacks by separate setter and a getter, or better yet, see if we can get rid of the need to have a setter. VALUE_REGNUM as an rval is definitely okay, as an lval, not so okay. > I will make that change if you agree. > > > > + const int len = TYPE_LENGTH (value_type (value)); > > > > Do we need check_typedefs here? > > I haven't faced a situation where this might make a difference, > but I think you are right. When taking the length of a type, > it should never be a typedef. I'd think we'd reach here with typedef'ed variables that lives in a registers, but maybe we're stripping typedefs earlier per chance. > One might even wonder if it would > make sense to adjust TYPE_LENGTH to to a check_typedef systematically... Maybe. I guess that we'd need profiling to make sure that wouldn't regress performance. I don't know if we have paths were we'd needlessly call check_typedef more times more. -- Pedro Alves