public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Cc: Sandra Loosemore <sandra@codesourcery.com>,
	       Pedro Alves <palves@redhat.com>,
	Doug Evans <dje@google.com>
Subject: [PATCH] Make remote transfers interruptible
Date: Wed, 12 Aug 2015 14:30:00 -0000	[thread overview]
Message-ID: <1439389814-29211-1-git-send-email-gbenson@redhat.com> (raw)
In-Reply-To: <55C3A10F.3010106@codesourcery.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

  parent reply	other threads:[~2015-08-12 14:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 15:28 [PATCH 0/2] Better handling of slow remote transfers Gary Benson
2015-08-05 15:28 ` [PATCH 1/2] Warn when accessing binaries over RSP Gary Benson
2015-08-11 11:55   ` Andrew Burgess
2015-08-11 14:04     ` Gary Benson
2015-08-13 13:24       ` [PATCH v2] Warn when accessing binaries from remote targets Gary Benson
2015-08-13 15:07         ` Andrew Burgess
2015-08-21 15:41         ` Pedro Alves
2015-08-21 16:23           ` [pushed] " Gary Benson
2015-08-05 15:28 ` [PATCH 2/2] Make remote file transfers interruptible Gary Benson
2015-08-06 18:03   ` Sandra Loosemore
2015-08-11 10:52     ` Gary Benson
2015-08-12 14:30     ` Gary Benson [this message]
2015-08-12 17:33       ` [PATCH] Make remote " Sandra Loosemore
2015-08-12 17:40         ` Doug Evans
2015-08-13  9:10         ` Gary Benson
2015-08-14 18:37           ` Joel Brobecker
2015-08-17 16:00         ` Pedro Alves
2015-08-17 18:54           ` Sandra Loosemore
2015-08-21 15:16   ` [PATCH 2/2] Make remote file " Pedro Alves
2015-08-21 16:23     ` [pushed] " Gary Benson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439389814-29211-1-git-send-email-gbenson@redhat.com \
    --to=gbenson@redhat.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=sandra@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).