From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12833 invoked by alias); 3 Mar 2008 20:10:26 -0000 Received: (qmail 12824 invoked by uid 22791); 3 Mar 2008 20:10:26 -0000 X-Spam-Check-By: sourceware.org Received: from bluesmobile.specifix.com (HELO bluesmobile.specifix.com) (216.129.118.140) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 03 Mar 2008 20:10:09 +0000 Received: from [127.0.0.1] (bluesmobile.specifix.com [216.129.118.140]) by bluesmobile.specifix.com (Postfix) with ESMTP id 6E7D73BF88; Mon, 3 Mar 2008 12:10:07 -0800 (PST) Subject: Re: [patch] Fix fortran access to special register on SPU arch From: Michael Snyder To: Markus Deuling Cc: GDB Patches , Ulrich Weigand In-Reply-To: <47CC4C37.3090502@de.ibm.com> References: <47CC4C37.3090502@de.ibm.com> Content-Type: text/plain Date: Mon, 03 Mar 2008 20:10:00 -0000 Message-Id: <1204575007.19253.573.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-7.fc7) Content-Transfer-Encoding: 7bit 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: 2008-03/txt/msg00016.txt.bz2 I understand the failure mode (not located in memory), but if value_subscript works in the register case, why wouldn't it work in general, rather than value_ind? On Mon, 2008-03-03 at 20:06 +0100, Markus Deuling wrote: > Hi, > > SPU architecture has 128 special register: > > (gdb) ptype $r0 > type = union __spu_builtin_type_vec128 { > int128_t uint128; > int64_t v2_int64[2]; > int32_t v4_int32[4]; > int16_t v8_int16[8]; > int8_t v16_int8[16]; > double v2_double[2]; > float v4_float[4]; > } > (gdb) > > when debugging a fortran binary GDB cannot access single elements of the above > elements regarded as arrays of int64, int32 ... > > (gdb) p $r0%v2_int64 > $1 = (635655159808, 0) > (gdb) p $r0%v2_int64(0) > Attempt to take address of value not located in memory. > (gdb) set $r0%v2_int64(0)=2 > Attempt to take address of value not located in memory. > (gdb) > > Access to fortran subranges is possible: > > (gdb) p $r0%v2_int64(0:0) > $2 = (635655159808) > (gdb) p $r0%v2_int64(0:1) > $3 = (635655159808, 0) > (gdb) p $r0%v2_int64 > $4 = (635655159808, 0) > (gdb) > > This patch invokes value_subscript for the special case that a multi_f77_subscript > is in a register instead of memory. > > (gdb) p $r0%uint128 > $2 = 0x00000094000000000000000000000000 > (gdb) p $r0%v2_int64 > $3 = (635655159808, 0) > (gdb) p $r0%v2_int64(0) > $4 = 635655159808 > > (gdb) set $r0%v2_int64(1)=5 > (gdb) p $r0%v2_int64(1) > $6 = 5 > (gdb) > > the gdb.fortran testsuite showed no regression on SPU. > If this patch is ok it would be great to have it in gdb 6.8. Ok ? > > ChangeLog: > > * eval.c (evaluate_subexp_standard): Call value_subscript for > accessing fortran array elements in registers. > > Regards, > Markus > > plain text document attachment (diff-fortran) > diff -urpN src/gdb/eval.c dev/gdb/eval.c > --- src/gdb/eval.c 2008-02-11 05:48:36.000000000 +0100 > +++ dev/gdb/eval.c 2008-03-03 19:23:37.000000000 +0100 > @@ -1720,6 +1720,8 @@ evaluate_subexp_standard (struct type *e > returns the correct type value */ > > deprecated_set_value_type (arg1, tmp_type); > + if (VALUE_LVAL (arg1) == lval_register) > + return value_subscript (arg1, arg2); > return value_ind (value_add (value_coerce_array (arg1), arg2)); > } >