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] mips_push_arguments(): Make O64 ABI test explicit


On Aug 1,  6:27pm, Andrew Cagney wrote:

> > That being the case, more than just the comment
> > will need to change.  (IMO, of course.)
> 
> In what way?  GDB was trying to implement things according to the ABI 
> (unless someone snuck in a change or the code suffered bit rot).

The short answer:  I've probably managed to bit rot it with one of my
other (as of yet unapplied) patches since it changes MIPS_SAVED_REGSIZE
for the N32 ABI.  Even if it weren't for this "bit rot", I'd still need
to change the code to accomodate the N64 ABI.

Long answer:

Let's look at the condition again...

 		  if (!MIPS_EABI
		      && MIPS_SAVED_REGSIZE < 8
 		      && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
 		      && partial_len < MIPS_SAVED_REGSIZE
 		      && (typecode == TYPE_CODE_STRUCT ||
		      ...

The part that bothers me in the above is ``MIPS_SAVED_REGSIZE < 8''.
This, in conjunction with !MIPS_EABI, is supposed to specify some
set of ABI's that the shifting operations needs to be performed on
when the other conditions hold.

The problem is that one of my other patches changes MIPS_SAVED_REGSIZE
for N32.  We can discuss whether my other patch is correct or not
elsewhere.  The point is that we shouldn't be using the value of
MIPS_SAVED_REGSIZE to be an indicator of the ABI which is in use.

In my opinion, it would be better for us to explicitly list the ABI's
affected.  That way someone reading the code doesn't need to deduce
the affected ABIs or scratch their heads over whether the prefatory
comment is correct or not.  I.e, maybe something like this:

 		  if ( (tdep->mips_abi == MIPS_ABI_O32
		        || tdep->mips_abi == MIPS_ABI_N32
		        || tdep->mips_abi == MIPS_ABI_N64)
 		      && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
 		      && partial_len < MIPS_SAVED_REGSIZE
 		      && (typecode == TYPE_CODE_STRUCT ||
		      ...

> As DanielJ mentioned, GCC should be fixed.

I agree with this.


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