From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21745 invoked by alias); 27 Nov 2006 22:31:18 -0000 Received: (qmail 21728 invoked by uid 22791); 27 Nov 2006 22:31:17 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 27 Nov 2006 22:31:11 +0000 Received: (qmail 7912 invoked from network); 27 Nov 2006 22:31:09 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 27 Nov 2006 22:31:09 -0000 To: "Ulrich Weigand" Cc: drow@false.org (Daniel Jacobowitz), gdb-patches@sourceware.org Subject: Re: [RFA][2/5] New port: Cell BE SPU (valops.c fix) References: <200611272206.kARM6OqG013008@d12av02.megacenter.de.ibm.com> From: Jim Blandy Date: Mon, 27 Nov 2006 22:31:00 -0000 In-Reply-To: <200611272206.kARM6OqG013008@d12av02.megacenter.de.ibm.com> (Ulrich Weigand's message of "Mon, 27 Nov 2006 23:06:24 +0100 (CET)") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2006-11/txt/msg00305.txt.bz2 "Ulrich Weigand" writes: >> It seems to me this is the problem to fix. When value_from_register >> retrieves a char from an SPU register, and that char is occupying byte >> three of the register, then if that value doesn't have its >> value_offset set, that seems wrong. You're using CONVERTIBLE_P and >> VALUE_TO_REGISTER / REGISTER_TO_VALUE to make up for that loss of >> information; why not actually provide it? > > So just to make sure I understood correctly, you'd suggesting that > I should *not* be using CONVERT_REGISTER_P for those registers? > > Instead, value_from_register should run into its default path, > and at the place where it computes the offset > > if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG > && len < register_size (current_gdbarch, regnum)) > /* Big-endian, and we want less than full size. */ > set_value_offset (v, register_size (current_gdbarch, regnum) - len); > else > set_value_offset (v, 0); > > we add some architecture-specific way to set a different offset? I had to think it through a bit, but yes, I think that's the way to do it. Then, won't the non-convertible register code in value_assign do the right read-modify-write thing without changes? My motivation is that it seems to me that 'struct value' already has stuff meant to handle these kinds of subregister references, but we're not using it. If we do use it, then value_struct_elt and value_subscript will do the right thing for us.