This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Re: Regression for gdbserver [Re: [PATCH] Linux/gdbserver: Fix memory read ptrace fallback issues]


On Tue, 22 May 2012 22:05:30 +0200, Maciej W. Rozycki wrote:
> it's difficult to chase something you can't reproduce.

I see that patch
	[RFC patch] non-release srctrees: --enable-targets=all & 64bit & -lmcheck
	http://sourceware.org/ml/gdb-patches/2012-05/msg00714.html

should include also better CFLAGS.  But the patch does not seem to go in so
far so we may continue with mail threads like this one.


>  I think however, that this memcpy call needs a rewrite now, I find your 
> proposal unreadable.

I find the whole function unreadable but this was true also before your patch.
But I did not try to change that in this fix up.  It also has 64-bit unsafe
bug using 'int' for memory sizes.

I find always more clear to calculate everything as START ADDRESS and ONE BYTE
AFTER THE LAST ADDRESS till the very last moment.


>   /* Copy appropriate bytes out of the buffer.  */
>   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);
>     }
> 
> ?

This code has equal functionality in my local testing.


Regards,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]