This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA]: SH patch for functions returning float/dbl
- To: Michael Snyder <msnyder at redhat dot com>
- Subject: Re: [RFA]: SH patch for functions returning float/dbl
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Mon, 5 Feb 2001 21:00:04 -0500 (EST)
- Cc: ezannoni at redhat dot com, gdb-patches at sources dot redhat dot com
- References: <3A3E8CED.80D7C355@redhat.com>
[sorry for the delay]
Michael, this patch improves things on a few sh CPU variants, but
breaks on those CPUs that don't have FP registers. Also it doesn't
deal with endiannes issues. So, I created an alternate patch which
I'll post separately.
But yes, your patch did get me going in cleaning this up.
Thanks
Elena
Michael Snyder writes:
> Elena, this will fix two failures in finish.exp.2000-12-18 Michael Snyder <msnyder@mvstp600e.cygnus.com>
>
> * sh-tdep.c (sh_extract_return_value):
> Handle floating point return value.
>
>
> Index: sh-tdep.c
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/sh-tdep.c,v
> retrieving revision 2.71
> diff -c -3 -p -r2.71 sh-tdep.c
> *** sh-tdep.c 2000/12/18 05:32:59 2.71
> --- sh-tdep.c 2000/12/18 22:12:07
> *************** static void
> *** 1228,1238 ****
> sh_extract_return_value (struct type *type, char *regbuf, char *valbuf)
> {
> int len = TYPE_LENGTH (type);
>
> if (len <= 4)
> ! memcpy (valbuf, ((char *) regbuf) + 4 - len, len);
> else if (len <= 8)
> ! memcpy (valbuf, ((char *) regbuf) + 8 - len, len);
> else
> error ("bad size for return value");
> }
> --- 1228,1245 ----
> sh_extract_return_value (struct type *type, char *regbuf, char *valbuf)
> {
> int len = TYPE_LENGTH (type);
> + int returnreg;
> +
> + if (TYPE_CODE (type) == TYPE_CODE_FLT)
> + returnreg = FP0_REGNUM;
> + else
> + returnreg = R0_REGNUM;
> +
>
> if (len <= 4)
> ! memcpy (valbuf, regbuf + REGISTER_BYTE (returnreg) + 4 - len, len);
> else if (len <= 8)
> ! memcpy (valbuf, regbuf + REGISTER_BYTE (returnreg) + 8 - len, len);
> else
> error ("bad size for return value");
> }