Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Richard Earnshaw <rearnsha@arm.com>
To: gdb@sources.redhat.com
Cc: Richard.Earnshaw@arm.com
Subject: read_register_byte can't work with pseudo-reg model
Date: Wed, 15 May 2002 09:52:00 -0000	[thread overview]
Message-ID: <200205151652.RAA12242@cam-mail2.cambridge.arm.com> (raw)


Given the following code in read_register_byte:

     reg_start = REGISTER_BYTE (regnum);
      reg_len = REGISTER_RAW_SIZE (regnum);
      reg_end = reg_start + reg_len;

      if (reg_end <= in_start || in_end <= reg_start)
	/* The range the user wants to read doesn't overlap with regnum.  */
	continue;

      if (REGISTER_NAME (regnum) != NULL && *REGISTER_NAME (regnum) != 
'\0')
	/* Force the cache to fetch the entire register.  */
	read_register_gen (regnum, reg_buf);
      else
	/* Legacy note: even though this register is ``invalid'' we
           still need to return something.  It would appear that some
           code relies on apparent gaps in the register array also
           being returned.  */
	/* FIXME: cagney/2001-08-18: This is just silly.  It defeats
           the entire register read/write flow of control.  Must
           resist temptation to return 0xdeadbeef.  */
	memcpy (reg_buf, registers + reg_start, reg_len);

Then the new model of having all named registers be pseudos will never 
re-read the registers, because all registers with an entry in registers[] 
will not have a name.

Shouldn't the "REGISTER_NAME" check be a direct check for 
register_cached(regno) == 0

That would mean that we could change the above to be something like

     reg_start = REGISTER_BYTE (regnum);
      reg_len = REGISTER_RAW_SIZE (regnum);
      reg_end = reg_start + reg_len;

      if (reg_end <= in_start || in_end <= reg_start)
	/* The range the user wants to read doesn't overlap with regnum.  */
	continue;

      if (register_cached (regnum) == 0)
	/* Force the cache to fetch the entire register.  */
	legacy_read_register_gen (regnum, reg_buf);
      else
	/* Legacy note: even though this register is ``invalid'' we
           still need to return something.  It would appear that some
           code relies on apparent gaps in the register array also
           being returned.  */
	/* FIXME: cagney/2001-08-18: This is just silly.  It defeats
           the entire register read/write flow of control.  Must
           resist temptation to return 0xdeadbeef.  */
	memcpy (reg_buf, registers + reg_start, reg_len);

Though I'm still not sure what we should do for a pseudo with no entry in 
the cache.

R.


             reply	other threads:[~2002-05-15 16:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-15  9:52 Richard Earnshaw [this message]
2002-05-15 12:43 ` Andrew Cagney
2002-05-16  5:19   ` Richard Earnshaw
2002-05-16  6:41     ` Andrew Cagney
2002-05-16  6:48       ` Richard Earnshaw
2002-05-16 12:08         ` Andrew Cagney
2002-05-16  8:36       ` Richard Earnshaw
2002-05-16 15:29         ` Andrew Cagney
2002-05-17  6:14           ` Richard Earnshaw
2002-05-17  7:51             ` Richard Earnshaw

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=200205151652.RAA12242@cam-mail2.cambridge.arm.com \
    --to=rearnsha@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gdb@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