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] sh-tdep.c (sh_use_struct_convention): Restructure and fix


On Oct 4,  1:35pm, Andrew Cagney wrote:

> >> See: http://sources.redhat.com/ml/gdb-patches/2003-10/msg00033.html.
> >> The ppc64_sysv_return_value code in ppc-sysv-tdep.c, has been written in 
> >> a way that allows a quick update to this new iterface.
> > 
> > Andrew,
> > 
> > There are pros and cons to the approach that you used in
> > ppc64_sysv_abi_return_value().
> > 
> > On the pro side - and this is definitely a good thing - you keep the
> > struct convention information together with the implementation of how
> > to return a value.
> 
> It is stronger than that, it moves all of the ABIs struct convention 
> logic to one place.

Huh?  What other parts are there?  (I fail to see why it's stronger
than what I stated.)

> At present key parts of the logic are scattered 
> inconsistently across core parts of GDB

Please explain.  How did the (traditional) ppc struct return
mechanisms get scattered across core parts of GDB?

> The result is a longer but more correct function.

More correct?  There is absolutely nothing which prevents a
traditional "use_struct_convention" function from being correct. 
What's "more correct" than "correct"?

I'll grant you that it may be easier to verify correctness by having
the struct convention code placed side by side with the value
(extract/store) return code.

And then again, it might not.  I can certainly envision an
architecture which has a very simple struct return convention, but for
which it's immensely complicated to implement the mechanics of that
convention.  (E.g, maybe a lot of twiddling is extract/store parts of
the code to get all the bits in the correct places.) In such a case,
having an easy to read "use_struct_convention" function would make it
easier to verify with respect to an ABI doc.

> > But this is also a con because you've spread the definition of
> > "use_struct_convention" out over a much larger number of lines.  It
> > isn't (IMO) as easy to comprehend when arranged in this way.
> 
> As my spec for the interface points out, if this were an OO language it 
> would have a different interface.
> 
> > The jury is still out (at least as far as I'm concerned) as to
> > which approach is better.  I do happen to think that your approach
> > is better for ppc64 (and ppc too), but this may not necessarily be the
> > case for other architectures.
> 
> This is a technical problem.  The return_value patch fixes the problem 
> of GDB not being able to handle all cases of:
> 
> 	return return-value-in-register
> 
> correctly.  If Corinna instead implements use_struct_convention, then 
> that bug won't be fixed.

You're referring to your WIP patch, right?  (Or did I miss a commit?)
You could certainly arrange to have you're WIP patch use the current
interfaces, couldn't you?  If you did, then that bug would be fixed
even with the traditional use_struct_convention code.

Kevin


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