This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] arm_extract_return_value, big-endian


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, 
+ 		  &regbuf[REGISTER_BYTE (ARM_A1_REGNUM)] 
+ 		  + (REGISTER_RAW_SIZE (ARM_A1_REGNUM) - TYPE_LENGTH (type)), 
+ 		  TYPE_LENGTH (type));
+ 	}
+       else
+ 	{
+ 	}
+     }
    else
      memcpy (valbuf, &regbuf[REGISTER_BYTE (ARM_A1_REGNUM)],
  	    TYPE_LENGTH (type));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]