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-tdep.c: Add dwarf/dwarf2 regnum mapping functions


On Mar 7, 12:03pm, Andrew Cagney wrote:

> > [Note: Irix cross some other mips target is currently broken due to
> > the fact that FP0_REGNUM is not multiarched yet.]
> 
> I don't think FP0_REGNUM should be multi-arched.  The only reference to 

I should point out that FP0_REGNUM is already in gdbarch.h.  What I meant
was that mips should be calling set_gdbarch_fp0_regnum() instead of
defining it via a macro in the tm-*.h files.

[...FP0_REGNUM reference in generic code elided]

> mips_tdep could certainly gain a local tdep->fp0_regnum though.

Did you notice the references to FP0_REGNUM in mips-linux-tdep.c and
mips-nat.c?.  If we do as you suggest, an access method will need to
be added to mips-tdep.h for getting at tdep->fp0_regnum (since you
refuse to export the mips tdep struct).  Also, all occurrences of
FP0_REGNUM in mips-linux-tdep.c and mips-nat.c will need to be
rewritten to use this access method.

Certainly all of this could be done, but the need to know the first
floating point register number is something that's shared among a
number of ports.  Doesn't it makes sense to define (as has already
been done) a common mechanism for determining this register number
rather than letting each port develop ad hoc methods?

> > Okay?
> 
> Yes, just make it a little bit more robust.  The i386 does this:
> 
>    /* This will hopefully provoke a warning.  */
>    return NUM_REGS + NUM_PSEUDO_REGS;
> 
> when it doesn't know what to do with a register.

Rather than hoping that returning an out of range register number will
provoke a warning (at some indeterminate point in the future),
wouldn't it be better to call complaint() directly?  Or, alternatively,
define a return value (e.g. -1) which callers of *_REG_TO_REGNUM would
then check so that an appropriate complaint could be registered?

Kevin


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