Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: cagney@redhat.com, gdb-patches@sources.redhat.com
Subject: Re: [RFA] regcache pseudo-reg tweak
Date: Tue, 05 Feb 2002 19:17:00 -0000	[thread overview]
Message-ID: <3C609EA2.8010DE01@redhat.com> (raw)
In-Reply-To: <3C609ECE.7020300@cygnus.com>

[-- Attachment #1: Type: text/plain, Size: 1932 bytes --]

Andrew Cagney wrote:
> 
> > 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).

Good.  Replaced with a simple "else" and checked in as attached below.

[-- Attachment #2: pseudo.patch --]
[-- Type: text/plain, Size: 1526 bytes --]

2002-02-05  Michael Snyder  <msnyder@redhat.com>

	* regcache.c (fetch_register): Call target_fetch_register
	only if we don't call FETCH_PSEUDO_REGISTER.
	(store_register): Call target_store_register only if we
	don't call STORE_PSEUDO_REGISTER.

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
!     target_fetch_registers (regnum);
  }
  
  /* Write register REGNUM cached value to the target.  */
*************** store_register (int regnum)
*** 140,146 ****
    if (STORE_PSEUDO_REGISTER_P ()
        && pseudo_register (regnum))
      STORE_PSEUDO_REGISTER (regnum);
!   target_store_registers (regnum);
  }
  
  /* Low level examining and depositing of registers.
--- 141,148 ----
    if (STORE_PSEUDO_REGISTER_P ()
        && pseudo_register (regnum))
      STORE_PSEUDO_REGISTER (regnum);
!   else
!     target_store_registers (regnum);
  }
  
  /* Low level examining and depositing of registers.

      reply	other threads:[~2002-02-06  3:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-05 18:33 Michael Snyder
2002-02-05 19:11 ` Andrew Cagney
2002-02-05 19:17   ` Michael Snyder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C609EA2.8010DE01@redhat.com \
    --to=msnyder@redhat.com \
    --cc=ac131313@cygnus.com \
    --cc=cagney@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox