Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] mips-n32 use_struct_convention
@ 2002-08-01 19:35 Michael Snyder
  2002-08-06 14:26 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2002-08-01 19:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: cagney, kevinb

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

This patch makes use_struct_convention work correctly for N32, 
and incidentally adds a couple of convenience macros (yes, they
are gdbarch-compatible).

This is one half of my earlier patch for N32, which I'll withdraw
if this and the following are acceptable.  Just splitting it up
for ease of review.

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

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

	*  mips-tdep.c: Define new macros MIPS_NEWABI, MIPS_OLDABI
	(by analogy with MIPS_EABI).
	(mips_use_struct_convention):  NEWABI (n32 and n64) uses
	same scheme as EABI.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.87
diff -c -3 -p -r1.87 mips-tdep.c
*** mips-tdep.c	1 Aug 2002 21:36:27 -0000	1.87
--- mips-tdep.c	2 Aug 2002 02:19:11 -0000
*************** struct gdbarch_tdep
*** 146,153 ****
      enum gdb_osabi osabi;
    };
  
! #define MIPS_EABI (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI32 \
! 		   || gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI64)
  
  #define MIPS_LAST_FP_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_fp_arg_regnum)
  
--- 146,162 ----
      enum gdb_osabi osabi;
    };
  
! #define MIPS_EABI \
!      (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI32 \
!       || gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI64)
! 
! #define MIPS_NEWABI \
!      (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_N32 \
!       || gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_N64)
! 
! #define MIPS_OLDABI \
!      (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_O32 \
!       || gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_O64)
  
  #define MIPS_LAST_FP_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_fp_arg_regnum)
  
*************** show_mask_address (char *cmd, int from_t
*** 561,570 ****
  int
  mips_use_struct_convention (int gcc_p, struct type *type)
  {
!   if (MIPS_EABI)
      return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
    else
!     return 1;			/* Structures are returned by ref in extra arg0 */
  }
  
  /* Tell if the program counter value in MEMADDR is in a MIPS16 function.  */
--- 570,579 ----
  int
  mips_use_struct_convention (int gcc_p, struct type *type)
  {
!   if (MIPS_EABI || MIPS_NEWABI)
      return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
    else
!     return 1;	/* Old ABI: structures are returned by ref in extra arg0 */
  }
  
  /* Tell if the program counter value in MEMADDR is in a MIPS16 function.  */

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

* Re: [RFA] mips-n32 use_struct_convention
  2002-08-01 19:35 [RFA] mips-n32 use_struct_convention Michael Snyder
@ 2002-08-06 14:26 ` Andrew Cagney
  2002-08-06 14:49   ` Michael Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2002-08-06 14:26 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

> *************** show_mask_address (char *cmd, int from_t
> *** 561,570 ****
>   int
>   mips_use_struct_convention (int gcc_p, struct type *type)
>   {
> !   if (MIPS_EABI)
>       return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
>     else
> !     return 1;			/* Structures are returned by ref in extra arg0 */
>   }
>   
>   /* Tell if the program counter value in MEMADDR is in a MIPS16 function.  */
> --- 570,579 ----
>   int
>   mips_use_struct_convention (int gcc_p, struct type *type)
>   {
> !   if (MIPS_EABI || MIPS_NEWABI)
>       return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
>     else
> !     return 1;	/* Old ABI: structures are returned by ref in extra arg0 */
>   }
>   

Rather than doing this, can you please create two functions --- one for 
each case --- and then update mips_gdbarch_init() accordingly.

Andrew



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

* Re: [RFA] mips-n32 use_struct_convention
  2002-08-06 14:26 ` Andrew Cagney
@ 2002-08-06 14:49   ` Michael Snyder
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Snyder @ 2002-08-06 14:49 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney wrote:
> 
> > *************** show_mask_address (char *cmd, int from_t
> > *** 561,570 ****
> >   int
> >   mips_use_struct_convention (int gcc_p, struct type *type)
> >   {
> > !   if (MIPS_EABI)
> >       return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
> >     else
> > !     return 1;                       /* Structures are returned by ref in extra arg0 */
> >   }
> >
> >   /* Tell if the program counter value in MEMADDR is in a MIPS16 function.  */
> > --- 570,579 ----
> >   int
> >   mips_use_struct_convention (int gcc_p, struct type *type)
> >   {
> > !   if (MIPS_EABI || MIPS_NEWABI)
> >       return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
> >     else
> > !     return 1;       /* Old ABI: structures are returned by ref in extra arg0 */
> >   }
> >
> 
> Rather than doing this, can you please create two functions --- one for
> each case --- and then update mips_gdbarch_init() accordingly.


OK.  Patch withdrawn pending rewrite.


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-01 19:35 [RFA] mips-n32 use_struct_convention Michael Snyder
2002-08-06 14:26 ` Andrew Cagney
2002-08-06 14: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