Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] arm_extract_return_value, big-endian
@ 2002-11-06 13:30 Michael Snyder
  2002-12-03  7:33 ` Fernando Nasser
  2002-12-03  7:41 ` Fernando Nasser
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Snyder @ 2002-11-06 13:30 UTC (permalink / raw)
  To: gdb-patches, rearnsha, cagney, kevinb

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

[This doesn't seem to have gone out.  Excuse me if it appears twice]

One of you arm-savvy guys check me out on this:
it seems logical, and it fixes two fails in callfuncs with -mbig-endian.

Michael

[-- Attachment #2: arm.patch --]
[-- Type: text/plain, Size: 848 bytes --]

2002-11-05  Michael Snyder  <msnyder@redhat.com>

	* arm-tdep.c (arm_extract_return_value): Handle offset of 
	small types on big-endian machines.

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	6 Nov 2002 01:54:36 -0000
*************** arm_extract_return_value (struct type *t
*** 2274,2279 ****
--- 2274,2284 ----
  	  break;
  	}
      }
+   else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+     memcpy (valbuf, 
+ 	    &regbuf[REGISTER_BYTE (ARM_A1_REGNUM)] 
+ 	     + (REGISTER_RAW_SIZE (ARM_A1_REGNUM) - TYPE_LENGTH (type)), 
+ 	    TYPE_LENGTH (type));
    else
      memcpy (valbuf, &regbuf[REGISTER_BYTE (ARM_A1_REGNUM)],
  	    TYPE_LENGTH (type));

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] arm_extract_return_value, big-endian
  2002-11-06 13:30 [RFA] arm_extract_return_value, big-endian Michael Snyder
@ 2002-12-03  7:33 ` Fernando Nasser
  2002-12-03  7:41 ` Fernando Nasser
  1 sibling, 0 replies; 6+ messages in thread
From: Fernando Nasser @ 2002-12-03  7:33 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches, rearnsha, cagney, kevinb

Well Michael, nobody has said anything, so if it seem to work lets make 
the change.  It seems reasonable to me.

My only question would be if we don't have any abstraction of the 
"extract a small type from a register" operation somewhere (arch vector, 
or an old macro).  But you've probably have checked for that already.

Regards to all,
Fernando

Michael Snyder wrote:
> [This doesn't seem to have gone out.  Excuse me if it appears twice]
> 
> One of you arm-savvy guys check me out on this:
> it seems logical, and it fixes two fails in callfuncs with -mbig-endian.
> 
> Michael
> 
> 
> ------------------------------------------------------------------------
> 
> 2002-11-05  Michael Snyder  <msnyder@redhat.com>
> 
> 	* arm-tdep.c (arm_extract_return_value): Handle offset of 
> 	small types on big-endian machines.
> 
> 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	6 Nov 2002 01:54:36 -0000
> *************** arm_extract_return_value (struct type *t
> *** 2274,2279 ****
> --- 2274,2284 ----
>   	  break;
>   	}
>       }
> +   else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
> +     memcpy (valbuf, 
> + 	    &regbuf[REGISTER_BYTE (ARM_A1_REGNUM)] 
> + 	     + (REGISTER_RAW_SIZE (ARM_A1_REGNUM) - TYPE_LENGTH (type)), 
> + 	    TYPE_LENGTH (type));
>     else
>       memcpy (valbuf, &regbuf[REGISTER_BYTE (ARM_A1_REGNUM)],
>   	    TYPE_LENGTH (type));


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] arm_extract_return_value, big-endian
  2002-11-06 13:30 [RFA] arm_extract_return_value, big-endian Michael Snyder
  2002-12-03  7:33 ` Fernando Nasser
@ 2002-12-03  7:41 ` Fernando Nasser
  2002-12-04  2:02   ` Richard Earnshaw
  1 sibling, 1 reply; 6+ messages in thread
From: Fernando Nasser @ 2002-12-03  7:41 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches, rearnsha, cagney, kevinb, fnasser

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?  I guess I will have to look into this closer (and my ARM 
manuals are not here right now either).

Please do not apply the patch yet Michael.  Sorry,. :-(

Fernando

Michael Snyder wrote:
> [This doesn't seem to have gone out.  Excuse me if it appears twice]
> 
> One of you arm-savvy guys check me out on this:
> it seems logical, and it fixes two fails in callfuncs with -mbig-endian.
> 
> Michael
> 
> 
> ------------------------------------------------------------------------
> 
> 2002-11-05  Michael Snyder  <msnyder@redhat.com>
> 
> 	* arm-tdep.c (arm_extract_return_value): Handle offset of 
> 	small types on big-endian machines.
> 
> 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	6 Nov 2002 01:54:36 -0000
> *************** arm_extract_return_value (struct type *t
> *** 2274,2279 ****
> --- 2274,2284 ----
>   	  break;
>   	}
>       }
> +   else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
> +     memcpy (valbuf, 
> + 	    &regbuf[REGISTER_BYTE (ARM_A1_REGNUM)] 
> + 	     + (REGISTER_RAW_SIZE (ARM_A1_REGNUM) - TYPE_LENGTH (type)), 
> + 	    TYPE_LENGTH (type));
>     else
>       memcpy (valbuf, &regbuf[REGISTER_BYTE (ARM_A1_REGNUM)],
>   	    TYPE_LENGTH (type));


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] arm_extract_return_value, big-endian
  2002-12-03  7:41 ` Fernando Nasser
@ 2002-12-04  2:02   ` Richard Earnshaw
  2003-01-07 23:46     ` Michael Snyder
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Earnshaw @ 2002-12-04  2:02 UTC (permalink / raw)
  To: Fernando Nasser
  Cc: Michael Snyder, gdb-patches, rearnsha, cagney, kevinb, fnasser


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.

R.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] arm_extract_return_value, big-endian
  2002-12-04  2:02   ` Richard Earnshaw
@ 2003-01-07 23:46     ` Michael Snyder
  2003-01-08  9:48       ` Richard Earnshaw
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2003-01-07 23:46 UTC (permalink / raw)
  To: Richard.Earnshaw
  Cc: Fernando Nasser, gdb-patches, rearnsha, cagney, kevinb, fnasser

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

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?

[-- Attachment #2: arm.diff --]
[-- Type: text/plain, Size: 793 bytes --]

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));

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] arm_extract_return_value, big-endian
  2003-01-07 23:46     ` Michael Snyder
@ 2003-01-08  9:48       ` Richard Earnshaw
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Earnshaw @ 2003-01-08  9:48 UTC (permalink / raw)
  To: Michael Snyder
  Cc: Richard.Earnshaw, Fernando Nasser, gdb-patches, rearnsha, cagney,
	kevinb, fnasser

> 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?

I think I've already fixed this.  Did you miss my request that you test it 
for me on a big-endian system?


http://sources.redhat.com/ml/gdb-patches/2002-12/msg00444.html

R.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-01-08  9:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-06 13:30 [RFA] arm_extract_return_value, big-endian Michael Snyder
2002-12-03  7:33 ` Fernando Nasser
2002-12-03  7:41 ` Fernando Nasser
2002-12-04  2:02   ` Richard Earnshaw
2003-01-07 23:46     ` Michael Snyder
2003-01-08  9:48       ` Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox