[RFC]: Pseudo-registers for GDB

Michael Snyder msnyder@cygnus.com
Mon Jul 10 11:29:00 GMT 2000


Eli Zaretskii wrote:
> 
> > Date: Fri, 07 Jul 2000 12:43:07 -0700
> > From: Michael Snyder <msnyder@cygnus.com>
> >
> > I want to add a general feature to GDB that will allow
> > a target architecture to define pseudo-registers
> > (things that are treated and accessed like registers,
> > but perhaps not represented in actual hardware and not
> > fetched from the target like real registers).
> 
> I'm for this.  One other application of this feature would be the FP
> registers of x86 that double as MMX registers.

Yep, those are on my radar.  ;-)

> 
> > As a first step, I propose to move the register cache from
> > its present ill-concieved location in findvar.c into its own
> > module (tentatively named regcache.c), and to make it a true
> > data object (with access functions to replace the direct
> > access that some modules now make).
> 
> Yes, this needs to be done first.
> 
> However, there's one more complication that makes this feature hard to
> implement.  When several logical registers share the same physical
> ones, GDB needs to know which interpretation is currently used by the
> inferior.  Otherwise, GDB will attempt to write to the same storage
> twice, each time with different contents, because the application
> layer of GDB does treat all the registers as separate entities.

The binary representation should be the same, right?
Like a union?  What I have in mind is that there will
be a distinction between "real" registers and "pseudo-regs".
Only "real" registers will be written to the target by GDB.
So in the case of an alias, you would pick one to be the
"real" register, and define one or more pseudo-regs as aliases.
These aliases would just be alternate ways of looking at the
same bit pattern.  Like a union.  The storage would only
be written once (for the "real" register).

> One way to handle this would be to make the distinction between the
> real and virtual registers be dynamic rather than static, e.g., by
> defining a function which says whether a given register is a real or a
> virtual one.

Is this really necessary?  Are the bit patterns different?


More information about the Gdb-patches mailing list