This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: ARM and virtual/raw registers
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: Richard dot Earnshaw at arm dot com
- Cc: gdb at sources dot redhat dot com
- Date: Sun, 12 May 2002 12:03:55 -0400
- Subject: Re: ARM and virtual/raw registers
- References: <200205121439.PAA00494@cam-mail2.cambridge.arm.com>
> rearnsha@arm.com said:
>
>> See the code below (which is very much a work-in-progress..., so
>> don't even expect it to compile ;-)
>
>
> Of course, there was a major flaw in the WIP code I just posted, that
> confuses what I was talking about in a significant way. The code for
> arm_register_read, should be:
(I guessed this :-)
> static void
> arm_register_read (struct gdbarch *gdbarch, int regno, char *buffer)
> {
> if (arm_register_info[regno].regcache != ARM_PHYS_NONE)
> /* Recover the register directly from the cache. */
> regcache_read (arm_register_info[regno].regcache, buffer);
> else
> arm_pseudo_register_read (gdbarch, regno, buffer);
> }
If I had my way, it would read:
> static void
> arm_register_read (struct gdbarch *gdbarch, struct pseudoreg *pseudo, char *buffer)
> {
> arm_pseudo_register_read (gdbarch, pseudo, buffer);
> }
however, that is a long way off (and, to be honest, I suspect the amount
of effort required would not give a reasonable return). In the mean
time, I recommend:
> static void
> arm_register_read (struct gdbarch *gdbarch, int regno, char *buffer)
> {
> gdb_assert (regno >= NUM_REGS && regno < NUM_REGS+NUM_PSEUDO_REGS);
> arm_pseudo_register_read (gdbarch, regno, buffer);
> }
Per, the other e-mail. Keeping the separation is very important. The
next person to work on the code won't know if they are looking at a
pseudo or raw register.
Having debugged code that used this approach, this this is very important.
enjoy,
Andrew