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] Unbreak DJGPP port of GDB


It turns out the DJGPP (a.k.a. "go32") port of GDB was broken more
than a year ago, by commits 9b40951 and bd265cd.  It stayed broken
ever since.  Lately, Andris Pavenis bisected the bug and posted the
results here:

  http://www.delorie.com/djgpp/mail-archives/browse.cgi?p=djgpp/2015/05/24/04:17:40

Looking into those changesets, I've found that the problem was due to
incorrect handling of values returned by functions 'read_child' and
'write_child', which are part of the DJGPP native debug support.

The patch below fixes that.  I will push it in a few days (with an
appropriate ChangeLog entry), if no one objects.

Thanks.

diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index f3966cd..4f5c2d2 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -587,10 +587,12 @@
   else
     res = read_child (memaddr, readbuf, len);
 
-  if (res <= 0)
+  /* read_child and write_child return zero on success, non-zero on
+     failure.  */
+  if (res != 0)
     return TARGET_XFER_E_IO;
 
-  *xfered_len = res;
+  *xfered_len = len;
   return TARGET_XFER_OK;
 }
 


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