From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13755 invoked by alias); 12 Jul 2006 19:22:04 -0000 Received: (qmail 13695 invoked by uid 22791); 12 Jul 2006 19:22:03 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 12 Jul 2006 19:22:01 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1G0kHW-0007gk-EU; Wed, 12 Jul 2006 15:21:58 -0400 Date: Wed, 12 Jul 2006 19:22:00 -0000 From: Daniel Jacobowitz To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: [PATCH] Cleanup target memory reading Message-ID: <20060712192158.GN24622@nevyn.them.org> Mail-Followup-To: Vladimir Prus , gdb-patches@sources.redhat.com References: <200606281155.59166.ghost@cs.msu.su> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200606281155.59166.ghost@cs.msu.su> User-Agent: Mutt/1.5.11+cvs20060403 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00126.txt.bz2 On Wed, Jun 28, 2006 at 11:55:57AM +0400, Vladimir Prus wrote: > > Hi, > at the moment, pretty much every read of target memory goes via > target_read_memory, and then via xfer_using_stratum. > > The only exception is the get_target_memory_unsigned function, which calls > target_read function. It's the only use of 'target_read'. > > The attached patch removes target_read, and makes get_target_memory_unsigned > use target_read_memory. > > OK? Since this was posted I added a use of target_read in the SPARC target :-( Let's leave it for now. > 2006-06-28 Vladimir Prus > > * target.h (target_read): Remove > (get_target_memory): Remove. > * target.c (target_read): Remove > (get_target_memory): Remove. > (get_target_memory_unsigned): Use target_read_memory. But if you want to commit the other two parts of this patch, that's OK. Except: > @@ -1404,25 +1381,13 @@ > return len; > } > > -/* Memory transfer methods. */ > - > -void > -get_target_memory (struct target_ops *ops, CORE_ADDR addr, gdb_byte *buf, > - LONGEST len) > -{ > - if (target_read (ops, TARGET_OBJECT_MEMORY, NULL, buf, addr, len) > - != len) > - memory_error (EIO, addr); > -} > - > ULONGEST > -get_target_memory_unsigned (struct target_ops *ops, > - CORE_ADDR addr, int len) > +get_target_memory_unsigned (CORE_ADDR addr, int len) > { > gdb_byte buf[sizeof (ULONGEST)]; > > gdb_assert (len <= sizeof (buf)); > - get_target_memory (ops, addr, buf, len); > + target_read_memory (addr, buf, len); > return extract_unsigned_integer (buf, len); > } > get_target_memory used to call memory_error if there was a problem. target_read_memory doesn't; it returns an error code. So you need to check it yourself. -- Daniel Jacobowitz CodeSourcery