when no data has been retrieved by ptrace.
+2012-05-22 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * linux-low.c (linux_store_registers): Avoid the copying sequence
+ when no data has been retrieved by ptrace.
+
2012-05-22 Will Deacon <will.deacon@arm.com>
* linux-low (__UCLIBC__ && !(__UCLIBC_HAS_MMU__ || __ARCH_HAS_MMU__)):
ret = errno;
/* Copy appropriate bytes out of the buffer. */
- i *= sizeof (PTRACE_XFER_TYPE);
- i -= memaddr & (sizeof (PTRACE_XFER_TYPE) - 1);
- memcpy (myaddr,
- (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)),
- i < len ? i : len);
+ if (i > 0)
+ {
+ i *= sizeof (PTRACE_XFER_TYPE);
+ i -= memaddr & (sizeof (PTRACE_XFER_TYPE) - 1);
+ memcpy (myaddr,
+ (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)),
+ i < len ? i : len);
+ }
return ret;
}