From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85581 invoked by alias); 12 Aug 2015 14:30:23 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 85534 invoked by uid 89); 12 Aug 2015 14:30:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 12 Aug 2015 14:30:17 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 32EE891EB0; Wed, 12 Aug 2015 14:30:16 +0000 (UTC) Received: from blade.nx (ovpn-116-40.ams2.redhat.com [10.36.116.40]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7CEUFpi021601; Wed, 12 Aug 2015 10:30:15 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id A50822643BD; Wed, 12 Aug 2015 15:30:14 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Cc: Sandra Loosemore , Pedro Alves , Doug Evans Subject: [PATCH] Make remote transfers interruptible Date: Wed, 12 Aug 2015 14:30:00 -0000 Message-Id: <1439389814-29211-1-git-send-email-gbenson@redhat.com> In-Reply-To: <55C3A10F.3010106@codesourcery.com> References: <55C3A10F.3010106@codesourcery.com> X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00288.txt.bz2 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