[2/2] Make remote file transfers interruptible

Message ID 1438788496-32246-3-git-send-email-gbenson@redhat.com
State New, archived
Headers

Commit Message

Gary Benson Aug. 5, 2015, 3:28 p.m. UTC
  This commit makes it possible to interrupt slow remote file transfers.

gdb/ChangeLog:

	* gdb_bfd.c (gdb_bfd_iovec_fileio_pread): Add QUIT call.
---
 gdb/ChangeLog |    4 ++++
 gdb/gdb_bfd.c |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)
  

Comments

Sandra Loosemore Aug. 6, 2015, 6:01 p.m. UTC | #1
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.

I think that this is the same patch that you sent earlier:

https://sourceware.org/ml/gdb/2015-07/msg00043.html

It still does not work for me.  :-(

-Sandra
  
Gary Benson Aug. 11, 2015, 10:52 a.m. UTC | #2
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.
> 
> I think that this is the same patch that you sent earlier:
> 
> https://sourceware.org/ml/gdb/2015-07/msg00043.html
> 
> It still does not work for me.  :-(

Ok, given the packet-size limit of RSP I was assuming GDB would read
the files in chunks the size of the server's packet buffer size (16k
for gdbserver) but it seems that that chunking happens at a lower
level, so the interrupt is only noticed between files rather than
between chunks.  I tested this patch using "remote get", but it seems
that that operates differently.  So I'm retracting this patch.

Making remote transfers properly interruptible looks like a fairly
involved task that's only slightly on my radar.  I've filed a bug
(https://sourceware.org/bugzilla/show_bug.cgi?id=18804) to keep the
issue from being forgotten.  I'll work on if I have some free time,
or someone else can do it.

The other patch in the series (the warning messages) can go in if
people find it useful.

Thanks,
Gary
  
Pedro Alves Aug. 21, 2015, 3:16 p.m. UTC | #3
On 08/05/2015 04:28 PM, 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.

OK.

Hopefully BFD doesn't get corrupted when an exception crosses it.
If it does, then we'll need to catch all exceptions before returning
to BFD, and return some "silently abort whatever you're doing" error.

Thanks,
Pedro Alves
  
Gary Benson Aug. 21, 2015, 4:23 p.m. UTC | #4
Pedro Alves wrote:
> On 08/05/2015 04:28 PM, 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.
> 
> OK.
> 
> Hopefully BFD doesn't get corrupted when an exception crosses it.
> If it does, then we'll need to catch all exceptions before returning
> to BFD, and return some "silently abort whatever you're doing"
> error.

Pushed to master and 7.10.

Thanks,
Gary
  

Patch

diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index b511777..575bd61 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -277,6 +277,8 @@  gdb_bfd_iovec_fileio_pread (struct bfd *abfd, void *stream, void *buf,
   pos = 0;
   while (nbytes > pos)
     {
+      QUIT;
+
       bytes = target_fileio_pread (fd, (gdb_byte *) buf + pos,
 				   nbytes - pos, offset + pos,
 				   &target_errno);