Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: Re: [rfc] Regcache revamp (vip)
Date: Sun, 18 Mar 2001 14:17:00 -0000	[thread overview]
Message-ID: <3AB3D655.E96868BD@cygnus.com> (raw)
In-Reply-To: <3AB2CE20.4AC725CF@cygnus.com>

The change to read_register_bytes() included:

> !       if (reg_start >= in_start && reg_end <= in_end)
> !       /* register fits inside of in_buf. */
> !       memcpy (in_buf + (reg_start - in_start), reg_buf, reg_len);
> !       else if (reg_start >= in_start && reg_end > in_end)
> !       /* register crosses the end of in_buf. */
> !       memcpy (in_buf + (reg_start - in_start), reg_buf, in_end - reg_start);
> !       else if (reg_start < in_start && reg_end <= in_end)
> !       /* register crosses the start of in_buf. */
> !       memcpy (in_buf, reg_buf + (in_start - reg_start),
> !               reg_end - in_start);
> !       else
> !       internal_error (__FILE__, __LINE__, "read_register_bytes botch");

Hmm, this is missing one case - in_buf fits in register.  Lets instead
try:

      /* start = max (reg_start, in_start) */
      if (reg_start > in_start)
        start = reg_start;
      else
        start = in_start;

      /* end = min (reg_end, in_end) */
      if (reg_end < in_end)
        end = reg_end;
      else
        end = in_end;

      /* Transfer just the bytes common to both IN_BUF and REG_BUF */
      for (byte = start; byte < end; byte++)
        {
          in_buf[byte - in_start] = reg_buf[byte - reg_start];
        }

Andrew


       reply	other threads:[~2001-03-18 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3AB2CE20.4AC725CF@cygnus.com>
2001-03-18 14:17 ` Andrew Cagney [this message]
2001-03-19 11:59 ` Andrew Cagney
2001-03-22 15:04 ` Jim Blandy
     [not found]   ` <3ABAAC0F.45A995A3@cygnus.com>
2001-03-23 17:26     ` Andrew Cagney

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=3AB3D655.E96868BD@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sourceware.cygnus.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