aboutsummaryrefslogtreecommitdiff
path: root/gdb/inf-ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/inf-ptrace.c')
-rw-r--r--gdb/inf-ptrace.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index dc3746b..edcad5a 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -459,11 +459,11 @@ inf_ptrace_wait (struct target_ops *ops,
inferior's OBJECT:ANNEX space and GDB's READBUF/WRITEBUF buffer.
Return the number of bytes actually transferred. */
-static LONGEST
+static enum target_xfer_status
inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len)
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
pid_t pid = ptid_get_pid (inferior_ptid);
@@ -490,13 +490,16 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
errno = 0;
if (ptrace (PT_IO, pid, (caddr_t)&piod, 0) == 0)
- /* Return the actual number of bytes read or written. */
- return piod.piod_len;
+ {
+ *xfered_len = piod.piod_len;
+ /* Return the actual number of bytes read or written. */
+ return 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
to indicate failure. */
if (errno != EINVAL)
- return 0;
+ return TARGET_XFER_EOF;
}
#endif
{
@@ -506,7 +509,7 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
gdb_byte byte[sizeof (PTRACE_TYPE_RET)];
} buffer;
ULONGEST rounded_offset;
- LONGEST partial_len;
+ ULONGEST partial_len;
/* Round the start offset down to the next long word
boundary. */
@@ -552,7 +555,7 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
(PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset,
buffer.word);
if (errno)
- return 0;
+ return TARGET_XFER_EOF;
}
}
@@ -563,13 +566,14 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
(PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset,
0);
if (errno)
- return 0;
+ return TARGET_XFER_EOF;
/* Copy appropriate bytes out of the buffer. */
memcpy (readbuf, buffer.byte + (offset - rounded_offset),
partial_len);
}
- return partial_len;
+ *xfered_len = partial_len;
+ return TARGET_XFER_OK;
}
case TARGET_OBJECT_UNWIND_TABLE:
@@ -592,8 +596,11 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
errno = 0;
if (ptrace (PT_IO, pid, (caddr_t)&piod, 0) == 0)
- /* Return the actual number of bytes read or written. */
- return piod.piod_len;
+ {
+ *xfered_len = piod.piod_len;
+ /* Return the actual number of bytes read or written. */
+ return TARGET_XFER_OK;
+ }
}
#endif
return TARGET_XFER_E_IO;