Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Markus Deuling <deuling@de.ibm.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: Ulrich Weigand <uweigand@de.ibm.com>
Subject: [patch] Fix fortran access to special register on SPU arch
Date: Mon, 03 Mar 2008 19:07:00 -0000	[thread overview]
Message-ID: <47CC4C37.3090502@de.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1502 bytes --]

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

-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


[-- Attachment #2: diff-fortran --]
[-- Type: text/plain, Size: 461 bytes --]

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));
       }
 

             reply	other threads:[~2008-03-03 19:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-03 19:07 Markus Deuling [this message]
2008-03-03 20:10 ` Michael Snyder
2008-03-03 20:22   ` Markus Deuling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47CC4C37.3090502@de.ibm.com \
    --to=deuling@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox