[patch]: Fix access to SPU registers for fortran
Markus Deuling
deuling@de.ibm.com
Fri Apr 18 19:54:00 GMT 2008
Hi,
this is a follow-up to a patch I posted a while ago:
http://sourceware.org/ml/gdb-patches/2008-03/msg00012.html
When debugging a fortran binary on SPU access to one of the 128-bit registers
fails. For example
(gdb) p $r0%v2_int64(0)
Attempt to take address of value not located in memory.
The reason for that is that the value is located in a register instead of inferior memory.
This is fixed with the attached patch:
(gdb) p $r7%v2_double
$3 = (0, 0)
(gdb) p $r7%v2_double(0)
$4 = 0
(gdb) p $r7%v2_double(1)
$5 = 0
(gdb) p $r7%v2_double(2)
no such vector element
(gdb) p $r7%v2_double(-1)
no such vector element
(gdb)
Internally 128-bit SPU registers are handled as a TYPE_CODE_UNION (__spu_builtin_type_vec128).
This patch adds support for TYPE_CODE_UNION in fortran language and also fixes the syntax of
"ptype" and "print $reg".
(gdb) ptype $r0
type = Type, C_Union :: __spu_builtin_type_vec128
int128_t :: uint128
int64_t :: v2_int64(0:1)
int32_t :: v4_int32(0:3)
int16_t :: v8_int16(0:7)
int8_t :: v16_int8(0:15)
double :: v2_double(0:1)
float :: v4_float(0:3)
End Type __spu_builtin_type_vec128
(gdb) p $r0
$2 = ( 0x00000094000000000000000000000000, (635655159808, 0), (148, 0, 0, 0), (0, 148, 0, 0, 0, 0, 0, 0), (0 '\000', 0 '\000', 0 '\000', -108 '\224', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000'), (3.140553770628603e-312, 0), (2.07392173e-43, 0, 0, 0) )
(gdb)
Testsuite showed no regression on SPU. Ok ?
ChangeLog:
* eval.c (evaluate_subexp_standard): Use value_subscripted_rvalue for
multi_f77_subscript to support values from registers.
* valarith.c (value_subscripted_rvalue): Remove prototype and static.
* value.h (value_subscripted_rvalue): Add prototype.
* f-typeprint.c (f_type_print_base): Add support for TYPE_CODE_UNION.
Fix output.
* f-valprint.c (f_val_print): Likewise.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff-spu-fortran-ptype
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20080418/6a16e810/attachment.ksh>
More information about the Gdb-patches
mailing list