From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12447 invoked by alias); 18 Nov 2011 17:40:23 -0000 Received: (qmail 12438 invoked by uid 22791); 18 Nov 2011 17:40:21 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate1.uk.ibm.com (HELO mtagate1.uk.ibm.com) (194.196.100.161) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Nov 2011 17:40:08 +0000 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id pAIHe66n012027 for ; Fri, 18 Nov 2011 17:40:06 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pAIHe69C2412672 for ; Fri, 18 Nov 2011 17:40:06 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pAIHe5XA023575 for ; Fri, 18 Nov 2011 10:40:06 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id pAIHe4Vc023523; Fri, 18 Nov 2011 10:40:04 -0700 Message-Id: <201111181740.pAIHe4Vc023523@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 18 Nov 2011 18:40:04 +0100 Subject: Re: Checked in: [RFA] read_frame_register_value and big endian arches To: brobecker@adacore.com (Joel Brobecker) Date: Fri, 18 Nov 2011 17:40:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org, tromey@redhat.com In-Reply-To: <20111118020121.GA2703@adacore.com> from "Joel Brobecker" at Nov 17, 2011 09:01:21 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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-11/txt/msg00505.txt.bz2 Joel Brobecker wrote: > > note that for big-endian architectures, value_offset is already > > correct, so if you'd respect it, you wouldn't need any special-purpose > > big-endian code. > > > > Also, if you'd respect value_offset, the SPU special cases would work. > > I will try to fix ASAP. I am sorry if that caused some fustration > when trying to do your testing. I didn't want to do the work in > the first place but I, too, got my testing broken by someone else's > change! No problem :-) I've now implemented a fix for read_frame_register_value by simply following the same logic as get_frame_register_bytes does. This fixes the regressions on SPU for me. Does this work for the platforms where you were seeing issues as well? Bye, Ulrich ChangeLog: * findvar.c (read_frame_register_value): Respect value_offset of the register value. Remove big-endian special case. Index: gdb/findvar.c =================================================================== RCS file: /cvs/src/src/gdb/findvar.c,v retrieving revision 1.139 diff -u -p -r1.139 findvar.c --- gdb/findvar.c 10 Nov 2011 17:14:40 -0000 1.139 +++ gdb/findvar.c 18 Nov 2011 16:49:05 -0000 @@ -631,31 +631,37 @@ default_value_from_register (struct type void read_frame_register_value (struct value *value, struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); int offset = 0; + int reg_offset = value_offset (value); int regnum = VALUE_REGNUM (value); const int len = TYPE_LENGTH (check_typedef (value_type (value))); gdb_assert (VALUE_LVAL (value) == lval_register); - while (offset < len) + /* Skip registers wholly inside of REG_OFFSET. */ + while (reg_offset >= register_size (gdbarch, regnum)) + { + reg_offset -= register_size (gdbarch, regnum); + regnum++; + } + + /* Copy the data. */ + while (len > 0) { struct value *regval = get_frame_register_value (frame, regnum); - int reg_len = TYPE_LENGTH (value_type (regval)); - int reg_offset = 0; + int reg_len = TYPE_LENGTH (value_type (regval)) - reg_offset; /* If the register length is larger than the number of bytes remaining to copy, then only copy the appropriate bytes. */ - if (offset + reg_len > len) - { - reg_len = len - offset; - if (gdbarch_byte_order (get_frame_arch (frame)) == BFD_ENDIAN_BIG) - reg_offset = TYPE_LENGTH (value_type (regval)) - reg_len; - } + if (reg_len > len) + reg_len = len; - value_contents_copy (value, offset, regval, - value_offset (regval) + reg_offset, reg_len); + value_contents_copy (value, offset, regval, reg_offset, reg_len); offset += reg_len; + len -= reg_len; + reg_offset = 0; regnum++; } } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com