This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Fix float/double return on x86-64
- From: Andreas Jaeger <aj at suse dot de>
- To: gdb-patches at sourceware dot cygnus dot com
- Date: Wed, 25 Jun 2003 21:13:43 +0200
- Subject: Fix float/double return on x86-64
The appended patch fixes these three failures on x86-64:
FAIL: gdb.base/return.exp: correct value returned double test (known problem with sparc solaris)
FAIL: gdb.base/return2.exp: float value returned successfully
FAIL: gdb.base/return2.exp: double value returned successfully
The code does not handle complex floating point values, I'm not sure
that it's correct there but I decided to fix this issue first.
Ok to commit for both branches?
Andreas
2003-06-25 Andreas Jaeger <aj@suse.de>
* x86-64-tdep.c (x86_64_store_return_value): Return double and
float values in SSE register.
============================================================
Index: src/gdb/x86-64-tdep.c
--- src/gdb/x86-64-tdep.c 15 Jun 2003 11:01:46 -0000 1.79
+++ src/gdb/x86-64-tdep.c 25 Jun 2003 19:10:46 -0000
@@ -712,8 +727,9 @@ x86_64_store_return_value (struct type *
{
int len = TYPE_LENGTH (type);
- if (TYPE_CODE_FLT == TYPE_CODE (type))
- {
+ /* First handle long doubles. */
+ if (TYPE_CODE_FLT == TYPE_CODE (type) && len == 16)
+ {
ULONGEST fstat;
char buf[FPU_REG_RAW_SIZE];
@@ -741,6 +757,12 @@ x86_64_store_return_value (struct type *
for the tag word is 0x3fff. */
regcache_raw_write_unsigned (regcache, FTAG_REGNUM, 0x3fff);
}
+ else if (TYPE_CODE_FLT == TYPE_CODE (type))
+ {
+ /* Handle double and float variables. */
+ regcache_cooked_write (regcache, X86_64_XMM0_REGNUM, valbuf);
+ }
+ /* XXX: What about complex floating point types? */
else
{
int low_size = REGISTER_RAW_SIZE (0);
--
Andreas Jaeger, SuSE Linux AG, aj@suse.de, http://www.suse.de/~aj
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126