This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfc] Regcache revamp (vip)
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: Re: [rfc] Regcache revamp (vip)
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Sat, 17 Mar 2001 16:25:41 -0500
- References: <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