This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit+7.4][arm] Fix PR tdep/12797 and callfuncs.exp regression
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Cc: patches at linaro dot org
- Date: Wed, 21 Dec 2011 22:19:58 +0100 (CET)
- Subject: [commit+7.4][arm] Fix PR tdep/12797 and callfuncs.exp regression
Hello,
in comparing 7.3 and 7.4 testsuite results on ARM I noticed this regression:
FAIL: gdb.base/callfuncs.exp: gdb function calls preserve register contents
The problem is that some of the preceding tests already failed due to
missing support for complex data types in arm_return_value. This had
previously been noticed and KFAILed as PR tdep/12797, but since the
inferior calls with wrong ABI actually segfault, we were now seeing
follow-on failures in unrelated tests in the same test case.
To fix this, the patch below simply implements the missing support for
complex types in arm_return_value.
Tested on arm-linux-gnueabi with no regressions.
Committed to mainline and 7.4.
Bye,
Ulrich
ChangeLog:
gdb/
PR tdep/12797
* arm-tdep.c (arm_return_value): Handle complex types.
gdb/testsuite/
PR tdep/12797
* gdb.base/callfuncs.exp: Remove KFAIL.
Index: gdb/arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.354
diff -u -p -r1.354 arm-tdep.c
--- gdb/arm-tdep.c 7 Dec 2011 20:53:08 -0000 1.354
+++ gdb/arm-tdep.c 21 Dec 2011 18:05:30 -0000
@@ -9061,6 +9061,12 @@ arm_return_value (struct gdbarch *gdbarc
return RETURN_VALUE_STRUCT_CONVENTION;
}
+ /* AAPCS returns complex types longer than a register in memory. */
+ if (tdep->arm_abi != ARM_ABI_APCS
+ && TYPE_CODE (valtype) == TYPE_CODE_COMPLEX
+ && TYPE_LENGTH (valtype) > INT_REGISTER_SIZE)
+ return RETURN_VALUE_STRUCT_CONVENTION;
+
if (writebuf)
arm_store_return_value (valtype, regcache, writebuf);
Index: gdb/testsuite/gdb.base/callfuncs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfuncs.exp,v
retrieving revision 1.46
diff -u -p -r1.46 callfuncs.exp
--- gdb/testsuite/gdb.base/callfuncs.exp 6 Dec 2011 14:14:50 -0000 1.46
+++ gdb/testsuite/gdb.base/callfuncs.exp 21 Dec 2011 18:05:33 -0000
@@ -248,19 +248,16 @@ proc do_function_calls {} {
if [support_complex_tests] {
setup_kfail_for_target gdb/12796 "x86_64-*-*"
- setup_kfail_for_target gdb/12797 "arm*-*-*"
gdb_test "p t_structs_fc(struct_val1)" ".*= 3 \\+ 3 \\* I" \
"call inferior func with struct - returns float _Complex"
setup_kfail_for_target gdb/12783 "i?86-*-*"
setup_kfail_for_target gdb/12796 "x86_64-*-*"
- setup_kfail_for_target gdb/12797 "arm*-*-*"
gdb_test "p t_structs_dc(struct_val1)" ".*= 4 \\+ 4 \\* I" \
"call inferior func with struct - returns double _Complex"
setup_kfail_for_target gdb/12783 "i?86-*-*"
setup_kfail_for_target gdb/12796 "x86_64-*-*"
- setup_kfail_for_target gdb/12797 "arm*-*-*"
gdb_test "p t_structs_ldc(struct_val1)" "= 5 \\+ 5 \\* I" \
"call inferior func with struct - returns long double _Complex"
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com