This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] regcache pseudo-reg tweak
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: Michael Snyder <msnyder at cygnus dot com>
- Cc: cagney at redhat dot com, gdb-patches at sources dot redhat dot com
- Date: Tue, 05 Feb 2002 22:11:10 -0500
- Subject: Re: [RFA] regcache pseudo-reg tweak
- References: <200202060226.g162QY120181@reddwarf.cygnus.com>
> I think you left out an "else" when you made this change in december.
> We must not call target_[fetch/store]_register with a pseudo-register,
> or they will choke. By definition, a pseudo-register is one that
> cannot be fetched from the target.
Oops, kind of.
> Index: regcache.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/regcache.c,v
> retrieving revision 1.31
> diff -c -3 -p -r1.31 regcache.c
> *** regcache.c 2002/01/29 20:24:27 1.31
> --- regcache.c 2002/02/06 02:30:46
> *************** fetch_register (int regnum)
> *** 125,131 ****
> if (FETCH_PSEUDO_REGISTER_P ()
> && pseudo_register (regnum))
> FETCH_PSEUDO_REGISTER (regnum);
> ! target_fetch_registers (regnum);
> }
>
> /* Write register REGNUM cached value to the target. */
> --- 125,132 ----
> if (FETCH_PSEUDO_REGISTER_P ()
> && pseudo_register (regnum))
> FETCH_PSEUDO_REGISTER (regnum);
> ! else if (real_register (regnum))
> ! target_fetch_registers (regnum);
> }
>
> /* Write register REGNUM cached value to the target. */
There should be an else but not else if (real_register ()) ....
A target can handle registers two ways - using pseudo-registers or using
register_{read,write}(). If a target uses the latter then it will
likely end up fetching registers in the pseudo-register range from the
target.
A simple example of this might be a modified x86 where not only the user
registers but also the system registers (MSRs?) are accessable. The
MSR's wouldn't be returned via the G packet but instead fetched
individually. Unfortunatly, NUM_REGS determines which registers are
included in a G packet (and many other obscure things).
Andrew