From patchwork Thu Aug 7 12:48:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 2336 Received: (qmail 24337 invoked by alias); 7 Aug 2014 12:52:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 24325 invoked by uid 89); 7 Aug 2014 12:52:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Aug 2014 12:52:40 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1XFNBM-0002er-QJ from Yao_Qi@mentor.com ; Thu, 07 Aug 2014 05:52:36 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 7 Aug 2014 05:52:36 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Thu, 7 Aug 2014 05:52:36 -0700 Message-ID: <53E375AF.6080004@codesourcery.com> Date: Thu, 7 Aug 2014 20:48:47 +0800 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Tom Tromey CC: Subject: Re: [PATCH] Replace 0 with TARGET_XFER_EOF in to_xfer_partial References: <1407306345-4371-1-git-send-email-yao@codesourcery.com> <87bnrxip09.fsf@fleche.redhat.com> In-Reply-To: <87bnrxip09.fsf@fleche.redhat.com> X-IsSubscribed: yes On 08/07/2014 12:03 AM, Tom Tromey wrote: > Looks good. > Patch is pushed in, in addition to the same replacement to remote_read_bytes in remote.c. > FWIW I think there should be a few more like this. > Maybe in ser-something.c? I'll take a look. > And also this code in remote_xfer_partial: > > /* Note: a zero OFFSET and LEN can be used to query the minimum > buffer size. */ > if (offset == 0 && len == 0) > return (get_remote_packet_size ()); > > There's a bug filed for this one. It is PR 17060. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 68d1db9..93bfc72 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2014-08-07 Yao Qi + * corelow.c (core_xfer_partial): Replace 0 with TARGET_XFER_EOF. + * remote-m32r-sdi.c (m32r_xfer_memory): Likewise. + * remote.c (remote_read_bytes): Likewise. + +2014-08-07 Yao Qi + * dwarf2read.c (struct dwarf2_per_cu_data) : Tweak comments. 2014-08-07 Yao Qi diff --git a/gdb/corelow.c b/gdb/corelow.c index ff4d733..ecd99f6 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -734,7 +734,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object, size = bfd_section_size (core_bfd, section); if (offset >= size) - return 0; + return TARGET_XFER_EOF; size -= offset; if (size > len) size = len; diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 5443fe0..3d6b0c6 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1080,7 +1080,7 @@ m32r_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf, if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory() failed\n"); - return 0; + return TARGET_XFER_EOF; } ret = send_data (writebuf, len); } @@ -1094,7 +1094,7 @@ m32r_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf, { if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory() failed\n"); - return 0; + return TARGET_XFER_EOF; } c = serial_readchar (sdi_desc, SDI_TIMEOUT); @@ -1102,7 +1102,7 @@ m32r_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf, { if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory() failed\n"); - return 0; + return TARGET_XFER_EOF; } ret = recv_data (readbuf, len); diff --git a/gdb/remote.c b/gdb/remote.c index 8decd08..473bb72 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6823,7 +6823,7 @@ remote_read_bytes (struct target_ops *ops, CORE_ADDR memaddr, gdb_byte *myaddr, ULONGEST len, ULONGEST *xfered_len) { if (len == 0) - return 0; + return TARGET_XFER_EOF; if (get_traceframe_number () != -1) {