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]

Re: [RFA] New register definition interface


On 13-Jan-2001, Andrew Cagney wrote:

>I know your code (unfortunatly) won't handle every case (new more bizare
>cases turn up every day)

True.  But I am hoping that the new interface will gradually replace the
old and that it will be easy to modify for more bizarre cases.

>[...regarding functions that check REGISTER_LIST...]
>I think these should be made virtual so that your, or any other, code
>can just drop in..

I can remove the REGISTER_LIST references from regcache.c and parse.c as
follows:

  1. Create new gdbarch.sh methods REAL_REGISTER, PSEUDO_REGISTER, etc.
     to replace those functions in regcache.c and parse.c.

  2. Default those new gdbarch.sh methods to non-regs.c versions, and
     override them for architectures that opt for regs.c (i.e., in
     regs_init_finish()).

Is that what you're suggesting?

However, I can't remove the REGISTER_LIST references from regs.c itself.
regs_init_start (<gdbarch>) initializes a structure containing information
specific to <gdbarch>, and as far as I can tell, there's no other way to
attach that structure to <gdbarch>.

>Did you get VALUE_REGNO() -> VALUE_REGNUM() in that rename?

No, the rename was local to regcache.c.

>The code doesn't appear to help how GDB handles register values in
>expressions and assignments (grep for VALUE_REGNO).  Have you thought
>about that?

By "help", do you mean "distinguish between target number and debugging
info number"?

The regs.c interface supports that distinction, but I haven't yet tried
removing the assumption throughout GDB that those two numbers are the
same.  Most register numbers throughout GDB are target numbers, so I think
it makes sense to adopt register target numbers as abstract register
handles and replace debugging info numbers with a gdbarch.sh method like
REGISTER_DEBUG_NUMBER (regnum).

I'll implement REGISTER_DEBUG_NUMBER in regs.c with something like this:

  static int
  regs_register_debug_number (int tnum)
  {
    struct reg *reg;

    reg = find_tnum (tnum, "regs_register_debug_number");
    return reg->dnum;
  }

Nick

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