This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Make remote transfers interruptible
- From: Gary Benson <gbenson at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Sandra Loosemore <sandra at codesourcery dot com>, Pedro Alves <palves at redhat dot com>, Doug Evans <dje at google dot com>
- Date: Wed, 12 Aug 2015 15:30:14 +0100
- Subject: [PATCH] Make remote transfers interruptible
- Authentication-results: sourceware.org; auth=none
- References: <55C3A10F dot 3010106 at codesourcery dot com>
Hi Sandra,
Sandra Loosemore wrote:
> On 08/05/2015 09:28 AM, Gary Benson wrote:
> > This commit makes it possible to interrupt slow remote file transfers.
> >
> > gdb/ChangeLog:
> >
> > * gdb_bfd.c (gdb_bfd_iovec_fileio_pread): Add QUIT call.
>
> It still does not work for me. :-(
Could you please try this newer version and see if it allows you to
interrupt the remote transfers?
Thanks,
Gary
---
diff --git a/gdb/remote.c b/gdb/remote.c
index 69da508..7db1e25 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10378,12 +10378,11 @@ remote_hostio_pwrite (struct target_ops *self,
remote_errno, NULL, NULL);
}
-/* Implementation of to_fileio_pread. */
+/* Helper for remote_hostio_pread. */
static int
-remote_hostio_pread (struct target_ops *self,
- int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, int *remote_errno)
+remote_hostio_pread_1 (int fd, gdb_byte *read_buf, int len,
+ ULONGEST offset, int *remote_errno)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf;
@@ -10417,6 +10416,37 @@ remote_hostio_pread (struct target_ops *self,
return ret;
}
+/* Implementation of to_fileio_pread. */
+
+static int
+remote_hostio_pread (struct target_ops *self,
+ int fd, gdb_byte *read_buf, int len,
+ ULONGEST offset, int *remote_errno)
+{
+ gdb_byte *buf = read_buf;
+
+ while (len > 0)
+ {
+ int ret;
+
+ QUIT;
+
+ ret = remote_hostio_pread_1 (fd, buf, min (len, 4096), offset,
+ remote_errno);
+ if (ret < 0)
+ return ret;
+
+ if (ret == 0)
+ break;
+
+ buf += ret;
+ offset += ret;
+ len -= ret;
+ }
+
+ return buf - read_buf;
+}
+
/* Implementation of to_fileio_close. */
static int
--
1.7.1