* [patch] Fix fortran access to special register on SPU arch
@ 2008-03-03 19:07 Markus Deuling
2008-03-03 20:10 ` Michael Snyder
0 siblings, 1 reply; 3+ messages in thread
From: Markus Deuling @ 2008-03-03 19:07 UTC (permalink / raw)
To: GDB Patches; +Cc: Ulrich Weigand
[-- 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));
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Fix fortran access to special register on SPU arch
2008-03-03 19:07 [patch] Fix fortran access to special register on SPU arch Markus Deuling
@ 2008-03-03 20:10 ` Michael Snyder
2008-03-03 20:22 ` Markus Deuling
0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2008-03-03 20:10 UTC (permalink / raw)
To: Markus Deuling; +Cc: GDB Patches, Ulrich Weigand
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));
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Fix fortran access to special register on SPU arch
2008-03-03 20:10 ` Michael Snyder
@ 2008-03-03 20:22 ` Markus Deuling
0 siblings, 0 replies; 3+ messages in thread
From: Markus Deuling @ 2008-03-03 20:22 UTC (permalink / raw)
To: Michael Snyder; +Cc: GDB Patches, Ulrich Weigand
[-- Attachment #1: Type: text/plain, Size: 333 bytes --]
Hi Michael,
Michael Snyder schrieb:
> 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?
>
it does. Attached patch works fine. Ok ?
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
[-- Attachment #2: diff-fortran --]
[-- Type: text/plain, Size: 446 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 21:19:32.000000000 +0100
@@ -1720,7 +1720,7 @@ evaluate_subexp_standard (struct type *e
returns the correct type value */
deprecated_set_value_type (arg1, tmp_type);
- return value_ind (value_add (value_coerce_array (arg1), arg2));
+ return value_subscript (arg1, arg2);
}
case BINOP_LOGICAL_AND:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-03 20:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-03 19:07 [patch] Fix fortran access to special register on SPU arch Markus Deuling
2008-03-03 20:10 ` Michael Snyder
2008-03-03 20:22 ` Markus Deuling
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox