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]

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


On Tue, 22 May 2012 14:43:21 +0200, Maciej W. Rozycki wrote:
>  I don't have these failures in my test run, which target is that?

Normal Fedora 17 x86_64 with:
	--with-system-zlib --enable-64-bit-bfd --enable-targets=all --enable-static --disable-shared --enable-debug --disable-sim --enable-gold --enable-plugins --with-separate-debug-dir=/usr/lib/debug --disable-option-checking --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=x86_64-unknown-linux-gnu CFLAGS="-m64 -g3 -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4" LDFLAGS="-lmcheck"
that is from my
	http://git.jankratochvil.net/?p=nethome.git;a=blob_plain;f=bin/errs12;hb=master


> Can you check that these are not intermittent failures

It was very 0% vs. 100% reproducible and for the single testcase.

No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu for gdbserver
mode.

I will check it in yet today as the HEAD is broken now.


Regards,
Jan

gdb/gdbserver/
2012-05-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* linux-low.c (linux_read_memory): Fix final memcpy size.

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 19f7be6..c33c976 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -4450,10 +4450,12 @@ linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 
   /* 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)
+    memcpy (myaddr,
+	    (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)),
+	    (MIN ((memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE)) + i,
+		  memaddr + len)
+	     - memaddr));
 
   return ret;
 }


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