This is the mail archive of the
mailing list for the GDB project.
Re: [RFA] legacy_[read/write]_register_gen
> Simplest case -- say you want to have a pseudo-register that
> mirrors the contents of a real register.
> static void
> my_fetch_pseudo_register (int regnum)
> if (regnum == MY_MIRROR_REGNUM)
> char buf[REGISTER_SIZE];
> regcache_read (MY_REAL_REGNUM, buf);
> regcache_write (MY_MIRROR_REGNUM, buf);
> You can't do that unles legacy_write_register_bytes can address
> the regcache location of your pseudo-register.
That should be implemented as:
my_register_read (int regnum, ...)
if (regnum == MY_MIRROR_REGNUM)
regcache_read (MY_REAL_REGNUM, buf)
regcache_read (regnum, buf);
GDB no longer needs to have duplicated register values in the regcache.
Anyway, I have figured out why the change is needed. You can end up
with ``real'' registers in the [NUM_REGS .. NUM_REGS+NUM_PSEUDO_REGS)
range. This happens (at present still theory) when a register that
isn't in the G packet is fetched.