aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2014-02-12 14:51:19 +0100
committerMark Kettenis <kettenis@gnu.org>2014-02-12 14:51:19 +0100
commit493443a47f514251f12e08223b2c56f0fed69015 (patch)
tree13b9bf19a9039cd7d735e0ae955960bb97a72433
parent706d088346930eeee11befa93330375164e175b9 (diff)
downloadgdb-493443a47f514251f12e08223b2c56f0fed69015.zip
gdb-493443a47f514251f12e08223b2c56f0fed69015.tar.gz
gdb-493443a47f514251f12e08223b2c56f0fed69015.tar.bz2
FIX EOF detection in PT_IO-based to_xfer_partial implementation.
At least on OpenBSD PT_IO/PIOD_READ_AUXV can return sucessfully without transferring any bytes. Arguably a kernel bug, but interpreting this as EOF seems sensible. gdb/ChangeLog: * inf-ptrace.c (inf_ptrace_xfer_partial): Return TARGET_XFER_EOF if a PT_IO ptrace request returns sucessfully but indicates that 0 bytes were transferred.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/inf-ptrace.c8
2 files changed, 10 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 41397b2..8d91946 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-12 Mark Kettenis <kettenis@gnu.org>
+
+ * inf-ptrace.c (inf_ptrace_xfer_partial): Return TARGET_XFER_EOF
+ if a PT_IO ptrace request returns sucessfully but indicates that 0
+ bytes were transferred.
+
2014-02-12 Pedro Alves <palves@redhat.com>
Kevin Buettner <kevinb@redhat.com>
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 1ab6b0b..1269d24 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -489,9 +489,9 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
errno = 0;
if (ptrace (PT_IO, pid, (caddr_t)&piod, 0) == 0)
{
- *xfered_len = piod.piod_len;
/* Return the actual number of bytes read or written. */
- return TARGET_XFER_OK;
+ *xfered_len = piod.piod_len;
+ return (piod.piod_len == 0) ? TARGET_XFER_EOF : TARGET_XFER_OK;
}
/* If the PT_IO request is somehow not supported, fallback on
using PT_WRITE_D/PT_READ_D. Otherwise we will return zero
@@ -595,9 +595,9 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
errno = 0;
if (ptrace (PT_IO, pid, (caddr_t)&piod, 0) == 0)
{
- *xfered_len = piod.piod_len;
/* Return the actual number of bytes read or written. */
- return TARGET_XFER_OK;
+ *xfered_len = piod.piod_len;
+ return (piod.piod_len == 0) ? TARGET_XFER_EOF : TARGET_XFER_OK;
}
}
#endif