Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@cygnus.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] pseudo-register un-optimization
Date: Mon, 13 Aug 2001 11:23:00 -0000	[thread overview]
Message-ID: <3B7819F8.6AA0FF98@cygnus.com> (raw)
In-Reply-To: <3B7473C0.5020702@cygnus.com>

Andrew Cagney wrote:
> 
> >
> >
> > 2001-08-10  Michael Snyder  <msnyder@redhat.com>
> >
> > * regcache.c (legacy_write_register_gen): Don't 'optimize out'
> >       a write_register to a pseudo-reg.  Target_store_pseudo_register
> >       needs to get called, because these regs may be computed and may
> >       have side-effects.
> 
> Michael, can you expand a little?  This is legacy code, so as long as
> this change is to keep an old target working, I'm not too fussed.
> 
> However, if this is for a new target then it should really be looking at
> gdbarch_register_{read,write} and bypassing the legacy mess entirely.

This is fixing an earlier change that broke part of the intended
functionality of pseudo-registers.  The pseudo-register store method
should be called any time that the pseudo-register is modified, even
if the pseudo-register is an alias for a real register.  This is so
that modifying a pseudo-register can have enforced side-effects such
as re-computing other pseudo-registers.


> 
>         Andrew
> 
> > Index: regcache.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/regcache.c,v
> > retrieving revision 1.24
> > diff -c -3 -p -r1.24 regcache.c
> > *** regcache.c        2001/06/15 23:50:46     1.24
> > --- regcache.c        2001/08/10 21:49:23
> > *************** legacy_write_register_gen (int regnum, c
> > *** 334,348 ****
> >
> >     size = REGISTER_RAW_SIZE (regnum);
> >
> > -   /* If we have a valid copy of the register, and new value == old value,
> > -      then don't bother doing the actual store. */
> > -
> > -   if (register_cached (regnum)
> > -       && memcmp (register_buffer (regnum), myaddr, size) == 0)
> > -     return;
> > -
> >     if (real_register (regnum))
> > !     target_prepare_to_store ();
> >
> >     memcpy (register_buffer (regnum), myaddr, size);
> >
> > --- 334,349 ----
> >
> >     size = REGISTER_RAW_SIZE (regnum);
> >
> >     if (real_register (regnum))
> > !     {
> > !       /* If we have a valid copy of the register, and new value == old
> > !      value, then don't bother doing the actual store. */
> > !       if (register_cached (regnum)
> > !       && memcmp (register_buffer (regnum), myaddr, size) == 0)
> > !     return;
> > !       else
> > !     target_prepare_to_store ();
> > !     }
> >
> >     memcpy (register_buffer (regnum), myaddr, size);
> >
> >


      reply	other threads:[~2001-08-13 11:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-10 14:54 Michael Snyder
2001-08-10 16:52 ` Andrew Cagney
2001-08-13 11:23   ` 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=3B7819F8.6AA0FF98@cygnus.com \
    --to=msnyder@cygnus.com \
    --cc=ac131313@cygnus.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