This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA]: Fix for sh function return value
- To: Elena Zannoni <ezannoni at cygnus dot com>
- Subject: Re: [RFA]: Fix for sh function return value
- From: Michael Snyder <msnyder at redhat dot com>
- Date: Tue, 02 Jan 2001 15:51:58 -0800
- CC: gdb-patches at sources dot redhat dot com, ezannoni at redhat dot com
- Organization: Red Hat, Inc.
- References: <3A3E4B9A.4B4CA060@redhat.com> <14910.21011.584602.600871@kwikemart.cygnus.com>
Elena Zannoni wrote:
>
> Thanks Michael.
> Go ahead.
Committed.
>
> Elena
>
> Michael Snyder writes:
> > This will fix two testsuite failures in return2.exp, wherein the
> > function's return type is smaller than the register size.2000-12-18 Michael Snyder <msnyder@mvstp600e.cygnus.com>
> >
> > * sh-tdep.c (sh_extract_return_value): Allow for small return type.
> > (sh_sh4_extract_return_value): Call sh_extract_return_value
> > for non-float types.
> >
> > 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 17:33:32
> > *************** sh_extract_return_value (struct type *ty
> > *** 1246,1253 ****
> > static void
> > sh_default_store_return_value (struct type *type, char *valbuf)
> > {
> > ! write_register_bytes (REGISTER_BYTE (0),
> > ! valbuf, TYPE_LENGTH (type));
> > }
> >
> > static void
> > --- 1246,1263 ----
> > static void
> > sh_default_store_return_value (struct type *type, char *valbuf)
> > {
> > ! char buf[32]; /* more than enough... */
> > !
> > ! if (TYPE_LENGTH (type) < REGISTER_RAW_SIZE (0))
> > ! {
> > ! /* Add leading zeros to the value. */
> > ! memset (buf, 0, REGISTER_RAW_SIZE (0));
> > ! memcpy (buf + REGISTER_RAW_SIZE (0) - TYPE_LENGTH (type),
> > ! valbuf, TYPE_LENGTH (type));
> > ! write_register_bytes (REGISTER_BYTE (0), buf, REGISTER_RAW_SIZE (0));
> > ! }
> > ! else
> > ! write_register_bytes (REGISTER_BYTE (0), valbuf, TYPE_LENGTH (type));
> > }
> >
> > static void
> > *************** sh3e_sh4_store_return_value (struct type
> > *** 1257,1264 ****
> > write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
> > valbuf, TYPE_LENGTH (type));
> > else
> > ! write_register_bytes (REGISTER_BYTE (0),
> > ! valbuf, TYPE_LENGTH (type));
> > }
> >
> > /* Print the registers in a form similar to the E7000 */
> > --- 1267,1273 ----
> > write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
> > valbuf, TYPE_LENGTH (type));
> > else
> > ! sh_default_store_return_value (type, valbuf);
> > }
> >
> > /* Print the registers in a form similar to the E7000 */