This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix printing functions with complex return on PPC64
- From: Tiago Stürmer Daitx <tdaitx at linux dot vnet dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Sat, 17 Nov 2012 09:59:39 -0600
- Subject: [PATCH] Fix printing functions with complex return on PPC64
This patch fix the current PPC64 return value code to properly handle complex
types by passing the target type of the COMPLEX value.
Previously two testcases from gdb.base/callfuncs.exp and another two from
gdb.base/varargs.exp would fail with GDB Interal Error due to improperly
calling convert_typed_floating with a COMPLEX type instead of using the
target type.
Excerpt from a diff between PPC64 run log before and after the fix:
-FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex (GDB internal error)
-FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex (GDB internal error)
-FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4) (GDB internal error)
-FAIL: gdb.base/varargs.exp: print find_max_double_real(4, dc1, dc2, dc3, dc4) (GDB internal error)
+FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4)
The existing FAIL is due to the complex arguments and will be fixed by another
patch series.
No regression was detected on PPC (32 bits) testcases.
Regards,
Tiago Daitx
gdb/Changelog
2012-11-01 Tiago Stürmer Daitx <tdaitx@linux.vnet.ibm.com>
* ppc-sysv-tdep.c (ppc64_sysv_abi_return_value): Set correct
type on float conversion for complex type.
---
gdb/ppc-sysv-tdep.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index a221b70..1a0f74d 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1925,7 +1925,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
{
convert_typed_floating ((const bfd_byte *) writebuf +
i * (TYPE_LENGTH (valtype) / 2),
- valtype, regval, regtype);
+ TYPE_TARGET_TYPE (valtype), regval,
+ regtype);
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + 1 + i,
regval);
@@ -1938,7 +1939,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
convert_typed_floating (regval, regtype,
(bfd_byte *) readbuf +
i * (TYPE_LENGTH (valtype) / 2),
- valtype);
+ TYPE_TARGET_TYPE (valtype));
}
}
}
--
1.7.1