From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9005 invoked by alias); 24 Aug 2009 11:27:18 -0000 Received: (qmail 8995 invoked by uid 22791); 24 Aug 2009 11:27:17 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 24 Aug 2009 11:27:11 +0000 Received: (qmail 25519 invoked from network); 24 Aug 2009 11:27:09 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 24 Aug 2009 11:27:09 -0000 From: Pedro Alves To: Aleksandar Ristovski Subject: Re: [patch] nto-procfs.c: Add to_xfer_partial Date: Mon, 24 Aug 2009 11:34:00 -0000 User-Agent: KMail/1.9.10 Cc: gdb-patches@sourceware.org References: <200907281222.26339.pedro@codesourcery.com> <4A6F5D74.3010108@qnx.com> In-Reply-To: <4A6F5D74.3010108@qnx.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908241226.59601.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2009-08/txt/msg00386.txt.bz2 On Tuesday 28 July 2009 21:20:04, Aleksandar Ristovski wrote: > Pedro Alves wrote: > > On Monday 27 July 2009 20:44:51, Aleksandar Ristovski wrote: > >> Pedro Alves wrote: > >>> (( Note: It isn't correct to defer to the target beneath for > >>> TARGET_OBJECT_MEMORY (and similars) objects, but, I see that nto-procfs.c > >>> is still implementing deprecated_xfer_memory. )) > >> Did you want me to make changes here? > > > > Nope, consider it an FYI. > > > > This offset > 0 check isn't really correct. Would it be hard to > > make this work with partial transfers? > > > > Implemented. > Thanks! On Tuesday 28 July 2009 21:20:04, Aleksandar Ristovski wrote: > ndex: gdb/nto-procfs.c > =================================================================== > RCS file: /cvs/src/src/gdb/nto-procfs.c,v > retrieving revision 1.48 > diff -u -p -r1.48 nto-procfs.c > --- gdb/nto-procfs.c 28 Jul 2009 13:20:26 -0000 1.48 > +++ gdb/nto-procfs.c 28 Jul 2009 20:16:21 -0000 > @@ -872,6 +872,56 @@ procfs_xfer_memory (CORE_ADDR memaddr, g > return (nbytes); > } > > +static LONGEST > +procfs_xfer_partial (struct target_ops *ops, enum target_object object, > + const char *annex, gdb_byte *readbuf, > + const gdb_byte *writebuf, ULONGEST offset, LONGEST len) > +{ > + if (object == TARGET_OBJECT_MEMORY) > + { > + int nbytes = 0; > + > + if (readbuf) > + return (*ops->deprecated_xfer_memory) (offset, readbuf, > + len, 0, NULL, ops); > + else if (writebuf) > + return (*ops->deprecated_xfer_memory) (offset, (gdb_byte*) writebuf, > + len, 1, NULL, ops); > + else > + return 0; > + } Hmmm, copying from procfs.c, are we? If you're going as far as implementing TARGET_OBJECT_MEMORY, then why stop there and still defer to ops->deprecated_xfer_memory? You could just ... > @@ -1405,6 +1455,7 @@ init_procfs_ops (void) > procfs_ops.to_store_registers = procfs_store_registers; > procfs_ops.to_prepare_to_store = procfs_prepare_to_store; > procfs_ops.deprecated_xfer_memory = procfs_xfer_memory; ... not install this ^^^^ and have procfs_xfer_partial call procfs_xfer_memory directly (might as well adjust its arguments/interface on the way). > + procfs_ops.to_xfer_partial = procfs_xfer_partial; Anyway, the patch looks fine to me as is. Feel free to go ahead and check it in. -- Pedro Alves