Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Michael Snyder <msnyder@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] legacy_[read/write]_register_gen
Date: Tue, 29 Jan 2002 11:22:00 -0000	[thread overview]
Message-ID: <3C56F660.5040902@cygnus.com> (raw)
In-Reply-To: <3C56EC48.8ACAC16B@redhat.com>


> 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)
	  else
	    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.

Andrew


  reply	other threads:[~2002-01-29 19:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-28 17:09 Michael Snyder
2002-01-28 19:19 ` Andrew Cagney
2002-01-29 10:45   ` Michael Snyder
2002-01-29 11:22     ` Andrew Cagney [this message]
2002-01-29 11:31       ` Michael Snyder
2002-01-29 13:29         ` Andrew Cagney
2002-01-29 14:48           ` Michael Snyder

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=3C56F660.5040902@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@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