From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: GDB Patches Subject: Re: [rfc] Regcache revamp (vip) Date: Sun, 18 Mar 2001 14:17:00 -0000 Message-id: <3AB3D655.E96868BD@cygnus.com> References: <3AB2CE20.4AC725CF@cygnus.com> X-SW-Source: 2001-03/msg00336.html 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