This is the mail archive of the gdb@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: ARM and virtual/raw registers


> 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



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