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] A few sh fixes


Corinna Vinschen writes:
 > Hi,
 > 
 > the below patch contains the following fixes for sh:
 > 
 > - Add some missing big/little endian stuff
 > - Try to match sh_use_struct_convention() more closely to the ABI.

Thanks. Any difference in test results with this fixes? They are
better right? :)

Elena



 > 
 > Corinna
 > 
 > 	* sh-tdep.c (sh_use_struct_convention): Use definition according to ABI.
 > 	(sh_push_arguments): Store in register with correct endianess.
 > 	(sh_default_store_return_value): Ditto.
 > 
 > Index: sh-tdep.c
 > ===================================================================
 > RCS file: /cvs/cvsfiles/devo/gdb/sh-tdep.c,v
 > retrieving revision 2.125.2.2
 > diff -u -p -r2.125.2.2 sh-tdep.c
 > --- sh-tdep.c	2002/09/26 13:57:06	2.125.2.2
 > +++ sh-tdep.c	2002/09/27 11:46:07
 > @@ -906,7 +906,14 @@ sh_saved_pc_after_call (struct frame_inf
 >  static int
 >  sh_use_struct_convention (int gcc_p, struct type *type)
 >  {
 > +#if 0
 >    return (TYPE_LENGTH (type) > 1);
 > +#else
 > +  int len = TYPE_LENGTH (type);
 > +  int nelem = TYPE_NFIELDS (type);
 > +  return ((len != 1 && len != 2 && len != 4 && len != 8) || nelem != 1) &&
 > +	  (len != 8 || TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) != 4);
 > +#endif
 >  }
 >  
 >  static int
 > @@ -2067,8 +2074,11 @@ sh_push_arguments (int nargs, struct val
 >        if (len < 4)
 >  	{
 >  	  /* value gets right-justified in the register or stack word */
 > -	  memcpy (valbuf + (4 - len),
 > -		  (char *) VALUE_CONTENTS (args[argnum]), len);
 > +	  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
 > +	    memcpy (valbuf + (4 - len),
 > +		    (char *) VALUE_CONTENTS (args[argnum]), len);
 > +	  else
 > +	    memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len);
 >  	  val = valbuf;
 >  	}
 >        else
 > @@ -2479,8 +2489,11 @@ sh_default_store_return_value (struct ty
 >      {
 >        /* Add leading zeros to the value. */
 >        memset (buf, 0, REGISTER_RAW_SIZE (R0_REGNUM));
 > -      memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type),
 > -	      valbuf, TYPE_LENGTH (type));
 > +      if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
 > +	memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type),
 > +		valbuf, TYPE_LENGTH (type));
 > +      else
 > +	memcpy (buf, valbuf, TYPE_LENGTH (type));
 >        write_register_bytes (REGISTER_BYTE (R0_REGNUM), buf, 
 >  			    REGISTER_RAW_SIZE (R0_REGNUM));
 >      }
 > 
 > -- 
 > Corinna Vinschen
 > Cygwin Developer
 > Red Hat, Inc.
 > mailto:vinschen@redhat.com


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