Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Mips, return_value_location, small structs
@ 2002-08-09 15:07 Michael Snyder
  2002-08-09 17:13 ` Andrew Cagney
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Snyder @ 2002-08-09 15:07 UTC (permalink / raw)
  To: cagney, gdb-patches

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

Re-submitted as a separate patch.

The problem: small structs returned in one (or two) registers
are aligned left in N32/N64 and aligned right in the others
(or vice versa, depending on how you cross your eyes).



There are two code paths here, one for structs of length < MIPS_REGSIZE, 
and one for MIPS_REGSIZE < struct len < 2 * MIPS_REGSIZE.

The first case I've split into two paths: one for N32 &&
TYPE_CODE_STRUCT, 
and a second for everything else (the later being identical to what was
there before).

In the second case, I've simply let the N32/N64 path fall thru.
The next "if" catches it and handles it correctly.

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

2002-08-08  Michael Snyder  <msnyder@redhat.com>

	* mips-tdep.c (return_value_location): Structs returned in 
	registers are aligned differently (n32/64 vs. o32/64).

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.92
diff -c -3 -p -r1.92 mips-tdep.c
*** mips-tdep.c	8 Aug 2002 00:26:51 -0000	1.92
--- mips-tdep.c	8 Aug 2002 21:48:09 -0000
*************** return_value_location (struct type *valt
*** 3608,3622 ****
        if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
  	  && len < MIPS_SAVED_REGSIZE)
  	{
! 	  /* "un-left-justify" the value in the low register */
! 	  lo->reg_offset = MIPS_SAVED_REGSIZE - len;
! 	  lo->len = len;
  	  hi->reg_offset = 0;
  	  hi->len = 0;
  	}
        else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
  	       && len > MIPS_SAVED_REGSIZE	/* odd-size structs */
  	       && len < MIPS_SAVED_REGSIZE * 2
  	       && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
  		   TYPE_CODE (valtype) == TYPE_CODE_UNION))
  	{
--- 3608,3635 ----
        if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
  	  && len < MIPS_SAVED_REGSIZE)
  	{
! 	  if ((gdbarch_tdep (current_gdbarch) -> mips_abi == MIPS_ABI_N32 
! 	       || gdbarch_tdep (current_gdbarch) -> mips_abi == MIPS_ABI_N64)
! 	      && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT 
! 		  || TYPE_CODE (valtype) == TYPE_CODE_UNION))
! 	    {
! 	      /* Values are already aligned in the low register.  */
! 	      lo->reg_offset = 0;
! 	    }
! 	  else
! 	    {
! 	      /* "un-left-justify" the value in the low register */
! 	      lo->reg_offset = MIPS_SAVED_REGSIZE - len;
! 	    }
  	  hi->reg_offset = 0;
+ 	  lo->len = len;
  	  hi->len = 0;
  	}
        else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
  	       && len > MIPS_SAVED_REGSIZE	/* odd-size structs */
  	       && len < MIPS_SAVED_REGSIZE * 2
+ 	       && gdbarch_tdep (current_gdbarch) -> mips_abi != MIPS_ABI_N32 
+ 	       && gdbarch_tdep (current_gdbarch) -> mips_abi != MIPS_ABI_N64
  	       && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
  		   TYPE_CODE (valtype) == TYPE_CODE_UNION))
  	{

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

* Re: [RFA] Mips, return_value_location, small structs
  2002-08-09 15:07 [RFA] Mips, return_value_location, small structs Michael Snyder
@ 2002-08-09 17:13 ` Andrew Cagney
  2002-08-09 17:37   ` Michael Snyder
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Cagney @ 2002-08-09 17:13 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

> Re-submitted as a separate patch.
> 
> The problem: small structs returned in one (or two) registers
> are aligned left in N32/N64 and aligned right in the others
> (or vice versa, depending on how you cross your eyes).

I _think_ you also need to add o32.  Can you check that out?  Just post 
the results, not the patch.

Andrew


> There are two code paths here, one for structs of length < MIPS_REGSIZE, 
> and one for MIPS_REGSIZE < struct len < 2 * MIPS_REGSIZE.
> 
> The first case I've split into two paths: one for N32 &&
> TYPE_CODE_STRUCT, 
> and a second for everything else (the later being identical to what was
> there before).
> 
> In the second case, I've simply let the N32/N64 path fall thru.
> The next "if" catches it and handles it correctly.
> 
> 
> 
> 2002-08-08  Michael Snyder  <msnyder@redhat.com>
> 
> 	* mips-tdep.c (return_value_location): Structs returned in 
> 	registers are aligned differently (n32/64 vs. o32/64).
> 
> Index: mips-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> retrieving revision 1.92
> diff -c -3 -p -r1.92 mips-tdep.c
> *** mips-tdep.c	8 Aug 2002 00:26:51 -0000	1.92
> --- mips-tdep.c	8 Aug 2002 21:48:09 -0000
> *************** return_value_location (struct type *valt
> *** 3608,3622 ****
>         if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
>   	  && len < MIPS_SAVED_REGSIZE)
>   	{
> ! 	  /* "un-left-justify" the value in the low register */
> ! 	  lo->reg_offset = MIPS_SAVED_REGSIZE - len;
> ! 	  lo->len = len;
>   	  hi->reg_offset = 0;
>   	  hi->len = 0;
>   	}
>         else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
>   	       && len > MIPS_SAVED_REGSIZE	/* odd-size structs */
>   	       && len < MIPS_SAVED_REGSIZE * 2
>   	       && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
>   		   TYPE_CODE (valtype) == TYPE_CODE_UNION))
>   	{
> --- 3608,3635 ----
>         if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
>   	  && len < MIPS_SAVED_REGSIZE)
>   	{
> ! 	  if ((gdbarch_tdep (current_gdbarch) -> mips_abi == MIPS_ABI_N32 
> ! 	       || gdbarch_tdep (current_gdbarch) -> mips_abi == MIPS_ABI_N64)
> ! 	      && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT 
> ! 		  || TYPE_CODE (valtype) == TYPE_CODE_UNION))
> ! 	    {
> ! 	      /* Values are already aligned in the low register.  */
> ! 	      lo->reg_offset = 0;
> ! 	    }
> ! 	  else
> ! 	    {
> ! 	      /* "un-left-justify" the value in the low register */
> ! 	      lo->reg_offset = MIPS_SAVED_REGSIZE - len;
> ! 	    }
>   	  hi->reg_offset = 0;
> + 	  lo->len = len;
>   	  hi->len = 0;
>   	}
>         else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
>   	       && len > MIPS_SAVED_REGSIZE	/* odd-size structs */
>   	       && len < MIPS_SAVED_REGSIZE * 2
> + 	       && gdbarch_tdep (current_gdbarch) -> mips_abi != MIPS_ABI_N32 
> + 	       && gdbarch_tdep (current_gdbarch) -> mips_abi != MIPS_ABI_N64
>   	       && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
>   		   TYPE_CODE (valtype) == TYPE_CODE_UNION))
>   	{



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

* Re: [RFA] Mips, return_value_location, small structs
  2002-08-09 17:13 ` Andrew Cagney
@ 2002-08-09 17:37   ` Michael Snyder
  2002-08-09 19:39     ` Andrew Cagney
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Snyder @ 2002-08-09 17:37 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney wrote:
> 
> > Re-submitted as a separate patch.
> >
> > The problem: small structs returned in one (or two) registers
> > are aligned left in N32/N64 and aligned right in the others
> > (or vice versa, depending on how you cross your eyes).
> 
> I _think_ you also need to add o32.  Can you check that out?  Just post
> the results, not the patch.

I know o32 needs work too, but the two can be treated separately.
I do guarantee that this patch does not make o32 any worse.
In fact, I have been testing to make sure that none of my patches
have made o32 any worse.

Can I check this one in for n32, if I promise to work on o32 next?


> 
> Andrew
> 
> > There are two code paths here, one for structs of length < MIPS_REGSIZE,
> > and one for MIPS_REGSIZE < struct len < 2 * MIPS_REGSIZE.
> >
> > The first case I've split into two paths: one for N32 &&
> > TYPE_CODE_STRUCT,
> > and a second for everything else (the later being identical to what was
> > there before).
> >
> > In the second case, I've simply let the N32/N64 path fall thru.
> > The next "if" catches it and handles it correctly.
> >
> >
> >
> > 2002-08-08  Michael Snyder  <msnyder@redhat.com>
> >
> >       * mips-tdep.c (return_value_location): Structs returned in
> >       registers are aligned differently (n32/64 vs. o32/64).
> >
> > Index: mips-tdep.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> > retrieving revision 1.92
> > diff -c -3 -p -r1.92 mips-tdep.c
> > *** mips-tdep.c       8 Aug 2002 00:26:51 -0000       1.92
> > --- mips-tdep.c       8 Aug 2002 21:48:09 -0000
> > *************** return_value_location (struct type *valt
> > *** 3608,3622 ****
> >         if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
> >         && len < MIPS_SAVED_REGSIZE)
> >       {
> > !       /* "un-left-justify" the value in the low register */
> > !       lo->reg_offset = MIPS_SAVED_REGSIZE - len;
> > !       lo->len = len;
> >         hi->reg_offset = 0;
> >         hi->len = 0;
> >       }
> >         else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
> >              && len > MIPS_SAVED_REGSIZE      /* odd-size structs */
> >              && len < MIPS_SAVED_REGSIZE * 2
> >              && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
> >                  TYPE_CODE (valtype) == TYPE_CODE_UNION))
> >       {
> > --- 3608,3635 ----
> >         if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
> >         && len < MIPS_SAVED_REGSIZE)
> >       {
> > !       if ((gdbarch_tdep (current_gdbarch) -> mips_abi == MIPS_ABI_N32
> > !            || gdbarch_tdep (current_gdbarch) -> mips_abi == MIPS_ABI_N64)
> > !           && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
> > !               || TYPE_CODE (valtype) == TYPE_CODE_UNION))
> > !         {
> > !           /* Values are already aligned in the low register.  */
> > !           lo->reg_offset = 0;
> > !         }
> > !       else
> > !         {
> > !           /* "un-left-justify" the value in the low register */
> > !           lo->reg_offset = MIPS_SAVED_REGSIZE - len;
> > !         }
> >         hi->reg_offset = 0;
> > +       lo->len = len;
> >         hi->len = 0;
> >       }
> >         else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
> >              && len > MIPS_SAVED_REGSIZE      /* odd-size structs */
> >              && len < MIPS_SAVED_REGSIZE * 2
> > +            && gdbarch_tdep (current_gdbarch) -> mips_abi != MIPS_ABI_N32
> > +            && gdbarch_tdep (current_gdbarch) -> mips_abi != MIPS_ABI_N64
> >              && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
> >                  TYPE_CODE (valtype) == TYPE_CODE_UNION))
> >       {


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

* Re: [RFA] Mips, return_value_location, small structs
  2002-08-09 17:37   ` Michael Snyder
@ 2002-08-09 19:39     ` Andrew Cagney
  2002-08-12 11:50       ` Michael Snyder
  2002-08-14 12:23       ` Michael Snyder
  0 siblings, 2 replies; 9+ messages in thread
From: Andrew Cagney @ 2002-08-09 19:39 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

> Andrew Cagney wrote:
> 
>> 
> 
>> > Re-submitted as a separate patch.
>> >
>> > The problem: small structs returned in one (or two) registers
>> > are aligned left in N32/N64 and aligned right in the others
>> > (or vice versa, depending on how you cross your eyes).
> 
>> 
>> I _think_ you also need to add o32.  Can you check that out?  Just post
>> the results, not the patch.
> 
> 
> I know o32 needs work too, but the two can be treated separately.
> I do guarantee that this patch does not make o32 any worse.
> In fact, I have been testing to make sure that none of my patches
> have made o32 any worse.
> 
> Can I check this one in for n32, if I promise to work on o32 next?

Why not just fix this bug for all three ABIs?  o32 is just like n32/n64 
in that it cross-eyes the arguments.

Andrew



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

* Re: [RFA] Mips, return_value_location, small structs
  2002-08-09 19:39     ` Andrew Cagney
@ 2002-08-12 11:50       ` Michael Snyder
  2002-08-14 12:23       ` Michael Snyder
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Snyder @ 2002-08-12 11:50 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney wrote:
> 
> > Andrew Cagney wrote:
> >
> >>
> >
> >> > Re-submitted as a separate patch.
> >> >
> >> > The problem: small structs returned in one (or two) registers
> >> > are aligned left in N32/N64 and aligned right in the others
> >> > (or vice versa, depending on how you cross your eyes).
> >
> >>
> >> I _think_ you also need to add o32.  Can you check that out?  Just post
> >> the results, not the patch.
> >
> >
> > I know o32 needs work too, but the two can be treated separately.
> > I do guarantee that this patch does not make o32 any worse.
> > In fact, I have been testing to make sure that none of my patches
> > have made o32 any worse.
> >
> > Can I check this one in for n32, if I promise to work on o32 next?
> 
> Why not just fix this bug for all three ABIs?  o32 is just like n32/n64
> in that it cross-eyes the arguments.

I said I would do it.  Why not accept this patch, which makes
things better than they were?


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

* Re: [RFA] Mips, return_value_location, small structs
  2002-08-09 19:39     ` Andrew Cagney
  2002-08-12 11:50       ` Michael Snyder
@ 2002-08-14 12:23       ` Michael Snyder
  2002-08-16 10:58         ` Andrew Cagney
  2002-08-19 14:39         ` Andrew Cagney
  1 sibling, 2 replies; 9+ messages in thread
From: Michael Snyder @ 2002-08-14 12:23 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney wrote:
> 
> > Andrew Cagney wrote:
> >
> >>
> >
> >> > Re-submitted as a separate patch.
> >> >
> >> > The problem: small structs returned in one (or two) registers
> >> > are aligned left in N32/N64 and aligned right in the others
> >> > (or vice versa, depending on how you cross your eyes).
> >
> >>
> >> I _think_ you also need to add o32.  Can you check that out?  Just post
> >> the results, not the patch.
> >
> >
> > I know o32 needs work too, but the two can be treated separately.
> > I do guarantee that this patch does not make o32 any worse.
> > In fact, I have been testing to make sure that none of my patches
> > have made o32 any worse.
> >
> > Can I check this one in for n32, if I promise to work on o32 next?
> 
> Why not just fix this bug for all three ABIs?  o32 is just like n32/n64
> in that it cross-eyes the arguments.

Andrew, o32 works as it is.  I can't find anything related to this
patch that still needs to be done for o32.  Unles you can suggest
something specific, may I check this patch in?

Michael


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

* Re: [RFA] Mips, return_value_location, small structs
  2002-08-14 12:23       ` Michael Snyder
@ 2002-08-16 10:58         ` Andrew Cagney
  2002-08-19 14:39         ` Andrew Cagney
  1 sibling, 0 replies; 9+ messages in thread
From: Andrew Cagney @ 2002-08-16 10:58 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

Michael,


Having fixed a few build problems (did you encounter similar?) I'm 
finding that I can't get an n32 GDB to recognize an n32 binary. Vis:

mips-sgi-irix6.5/gdb/gdb": not in executable format: File format not 
recognized
file ./gdb/gdb
./gdb/gdb:      ELF N32 MSB mips-4 dynamic executable (not stripped) 
MIPS - version 1

Is there anything special I need?

Andrew



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

* Re: [RFA] Mips, return_value_location, small structs
  2002-08-14 12:23       ` Michael Snyder
  2002-08-16 10:58         ` Andrew Cagney
@ 2002-08-19 14:39         ` Andrew Cagney
  2002-08-20 11:49           ` Michael Snyder
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Cagney @ 2002-08-19 14:39 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

> I know o32 needs work too, but the two can be treated separately.
>> > I do guarantee that this patch does not make o32 any worse.
>> > In fact, I have been testing to make sure that none of my patches
>> > have made o32 any worse.
>> >
>> > Can I check this one in for n32, if I promise to work on o32 next?
> 
>> 
>> Why not just fix this bug for all three ABIs?  o32 is just like n32/n64
>> in that it cross-eyes the arguments.
> 
> 
> Andrew, o32 works as it is.  I can't find anything related to this
> patch that still needs to be done for o32.  Unles you can suggest
> something specific, may I check this patch in?

FYI, this patch should now be redundant.  I rewrote the n32/n64 
extract/store return value code.

Andrew



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

* Re: [RFA] Mips, return_value_location, small structs
  2002-08-19 14:39         ` Andrew Cagney
@ 2002-08-20 11:49           ` Michael Snyder
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Snyder @ 2002-08-20 11:49 UTC (permalink / raw)
  To: Andrew Cagney, gdb-patches

Andrew Cagney wrote:
> 
> > I know o32 needs work too, but the two can be treated separately.
> >> > I do guarantee that this patch does not make o32 any worse.
> >> > In fact, I have been testing to make sure that none of my patches
> >> > have made o32 any worse.
> >> >
> >> > Can I check this one in for n32, if I promise to work on o32 next?
> >
> >>
> >> Why not just fix this bug for all three ABIs?  o32 is just like n32/n64
> >> in that it cross-eyes the arguments.
> >
> >
> > Andrew, o32 works as it is.  I can't find anything related to this
> > patch that still needs to be done for o32.  Unles you can suggest
> > something specific, may I check this patch in?
> 
> FYI, this patch should now be redundant.  I rewrote the n32/n64
> extract/store return value code.

Check, this patch is no longer pertainant.
Withdrawn.


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

end of thread, other threads:[~2002-08-20 18:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-09 15:07 [RFA] Mips, return_value_location, small structs Michael Snyder
2002-08-09 17:13 ` Andrew Cagney
2002-08-09 17:37   ` Michael Snyder
2002-08-09 19:39     ` Andrew Cagney
2002-08-12 11:50       ` Michael Snyder
2002-08-14 12:23       ` Michael Snyder
2002-08-16 10:58         ` Andrew Cagney
2002-08-19 14:39         ` Andrew Cagney
2002-08-20 11:49           ` Michael Snyder

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