convert to_has_exited
[binutils-gdb.git] / gdb / inf-ptrace.c
index edcad5aa82640ed0ace71b9025b3d0b18ec8202b..bffb4bac0311bcf5585bd49bfa6341309ce12a62 100644 (file)
@@ -147,7 +147,7 @@ inf_ptrace_create_inferior (struct target_ops *ops,
 #ifdef PT_GET_PROCESS_STATE
 
 static void
-inf_ptrace_post_startup_inferior (ptid_t pid)
+inf_ptrace_post_startup_inferior (struct target_ops *self, ptid_t pid)
 {
   ptrace_event_t pe;
 
@@ -246,7 +246,7 @@ inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty)
 #ifdef PT_GET_PROCESS_STATE
 
 static void
-inf_ptrace_post_attach (int pid)
+inf_ptrace_post_attach (struct target_ops *self, int pid)
 {
   ptrace_event_t pe;
 
@@ -321,7 +321,7 @@ inf_ptrace_kill (struct target_ops *ops)
 /* Stop the inferior.  */
 
 static void
-inf_ptrace_stop (ptid_t ptid)
+inf_ptrace_stop (struct target_ops *self, ptid_t ptid)
 {
   /* Send a SIGINT to the process group.  This acts just like the user
      typed a ^C on the controlling terminal.  Note that using a
@@ -455,9 +455,7 @@ inf_ptrace_wait (struct target_ops *ops,
   return pid_to_ptid (pid);
 }
 
-/* Attempt a transfer all LEN bytes starting at OFFSET between the
-   inferior's OBJECT:ANNEX space and GDB's READBUF/WRITEBUF buffer.
-   Return the number of bytes actually transferred.  */
+/* Implement the to_xfer_partial target_ops method.  */
 
 static enum target_xfer_status
 inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
@@ -491,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
@@ -597,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