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: [ppc64-linux]: register CONVERT_FROM_FUNC_PTR_ADDR method


On Jun 12,  9:48pm, Richard Henderson wrote:

> On Thu, Jun 12, 2003 at 04:11:31PM -0500, Jim Blandy wrote:
> > + /* Support for CONVERT_FROM_FUNC_PTR_ADDR(ADDR) on PPC64 Linux.
> 
> Not just Linux, but everywhere else as well.
> 
> Indeed, the 64-bit ABI lifts this from 32-bit AIX, so it seems
> like this function should be generic in the ppc backend somewhere.

It does exist in rs6000-tdep.c (as rs6000_convert_from_func_ptr_addr)
and I believe that that function would work for 64-bit PPC Linux also.

So, an alternate approach (to what Jim did) is to export
rs6000_convert_from_func_ptr_addr() via ppc-tdep.h and then register
it in ppc-linux-tdep.c.  That may be preferable in this case since
this function is relatively simple and it could be argued that if
there is a bug in the code, it would likely be a bug for both ABIs. 
Fixing such a bug in one location is preferable to having to fix it in
multiple locations.

OTOH, there's been a recent trend towards separating this kind of
thing out for different ABIs.  E.g, look at all of push_argument
variants in mips-tdep.c.  At one time, not too long ago, all of
the push_argument() variants were rolled into one big function.
(There are some other MIPS related examples that are somewhat
less extreme.)  The reason that this was done is so that fixes
may be made to the support of a given ABI without having to worry
about breaking the support for the other ABIs.

There are pros and cons to each approach and, for this case, I don't
see a clear cut winner.  Since Jim is in the code at the moment, and
has been giving it a lot of thought, I'll leave it up to him to decide
on the best course of action.

Kevin


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