diff options
author | Yao Qi <yao@codesourcery.com> | 2014-08-11 19:02:58 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2014-08-19 21:08:38 +0800 |
commit | 817e0957a556d241be6f8c5e0e649ac53b1fb020 (patch) | |
tree | 36cb1a05693fdbb2cce9c0c3985cd1fdeb7a0c90 /gdb/arm-tdep.c | |
parent | 2974be626b5e40033b9a259a072b2fe123469126 (diff) | |
download | gdb-817e0957a556d241be6f8c5e0e649ac53b1fb020.zip gdb-817e0957a556d241be6f8c5e0e649ac53b1fb020.tar.gz gdb-817e0957a556d241be6f8c5e0e649ac53b1fb020.tar.bz2 |
Support _Complex in hard-VFP abi
Hi,
When we pass "-mfloat-abi=hard" flag in the GDB testing, we see the
following fails,
FAIL: gdb.base/callfuncs.exp: p t_float_complex_values(fc1, fc2)
FAIL: gdb.base/callfuncs.exp: p t_float_complex_many_args(fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4)
FAIL: gdb.base/callfuncs.exp: p t_double_complex_values(dc1, dc2)
FAIL: gdb.base/callfuncs.exp: p t_double_complex_many_args(dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4)
FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_values(ldc1, ldc2)
FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_many_args(ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4)
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex
FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex
The hard-VFP ABI was supported by GDB overal, done by this patch
https://sourceware.org/ml/gdb-patches/2009-07/msg00686.html but
"vectors and complex types are not currently supported", mentioned in
the patch. As a result, these tests fail.
This patch is to support _Complex types in hard-VFP abi. As specified
in "7.1.1, Procedure Call Standard for the ARM Arch", the layout of
_Complex types is a struct, which is identical to the layout on amd64,
so I copy Mark's comments to amd64 support.
Regression tested on arm-none-eabi target. OK to apply?
gdb:
2014-08-19 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (arm_vfp_cprc_sub_candidate): Handle _Complex
types.
Diffstat (limited to 'gdb/arm-tdep.c')
-rw-r--r-- | gdb/arm-tdep.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index b746eee..db97fed 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -3562,8 +3562,8 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b) classified from *BASE_TYPE, or two types differently classified from each other, return -1, otherwise return the total number of base-type elements found (possibly 0 in an empty structure or - array). Vectors and complex types are not currently supported, - matching the generic AAPCS support. */ + array). Vector types are not currently supported, matching the + generic AAPCS support. */ static int arm_vfp_cprc_sub_candidate (struct type *t, @@ -3594,6 +3594,36 @@ arm_vfp_cprc_sub_candidate (struct type *t, } break; + case TYPE_CODE_COMPLEX: + /* Arguments of complex T where T is one of the types float or + double get treated as if they are implemented as: + + struct complexT + { + T real; + T imag; + }; */ + switch (TYPE_LENGTH (t)) + { + case 8: + if (*base_type == VFP_CPRC_UNKNOWN) + *base_type = VFP_CPRC_SINGLE; + else if (*base_type != VFP_CPRC_SINGLE) + return -1; + return 2; + + case 16: + if (*base_type == VFP_CPRC_UNKNOWN) + *base_type = VFP_CPRC_DOUBLE; + else if (*base_type != VFP_CPRC_DOUBLE) + return -1; + return 2; + + default: + return -1; + } + break; + case TYPE_CODE_ARRAY: { int count; |