This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] arm_extract_return_value, big-endian
- From: Michael Snyder <msnyder at redhat dot com>
- To: Richard dot Earnshaw at arm dot com
- Cc: Fernando Nasser <fnasser at redhat dot com>, gdb-patches at sources dot redhat dot com, rearnsha at arm dot com, cagney at redhat dot com, kevinb at redhat dot com, fnasser <fnasser at tooth dot toronto dot redhat dot com>
- Date: Tue, 07 Jan 2003 15:46:04 -0800
- Subject: Re: [RFA] arm_extract_return_value, big-endian
- Organization: Red Hat, Inc.
- References: <200212041002.gB4A27w05408@pc960.cambridge.arm.com>
Richard Earnshaw wrote:
>
> fnasser@redhat.com said:
> > Humm..., I am having second thoughts about this. Isn't the problem
> > you are seeing the same problem of not having the values peoperly
> > sign-extended?
>
> No. In this case we really need to copy the least significant 1 (or 2)
> bytes into the 1 or 2 bytes in the valbuf target. That means doing a copy
> from the higher addresses. So in that respect, the patch is correct.
>
> But it breaks the case where the return value is more than one word.
Yes, I see that now. Richard, how about a joint effort?
Would you be so kind as to fill in the empty else clause?
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.74
diff -p -r1.74 arm-tdep.c
*** arm-tdep.c 1 Nov 2002 21:21:49 -0000 1.74
--- arm-tdep.c 7 Jan 2003 23:45:19 -0000
*************** arm_extract_return_value (struct type *t
*** 2274,2279 ****
--- 2274,2292 ----
break;
}
}
+ else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+ {
+ if (TYPE_LENGTH (type) <= REGISTER_SIZE)
+ {
+ memcpy (valbuf,
+ ®buf[REGISTER_BYTE (ARM_A1_REGNUM)]
+ + (REGISTER_RAW_SIZE (ARM_A1_REGNUM) - TYPE_LENGTH (type)),
+ TYPE_LENGTH (type));
+ }
+ else
+ {
+ }
+ }
else
memcpy (valbuf, ®buf[REGISTER_BYTE (ARM_A1_REGNUM)],
TYPE_LENGTH (type));