From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3954 invoked by alias); 8 Apr 2009 22:18:37 -0000 Received: (qmail 3945 invoked by uid 22791); 8 Apr 2009 22:18:36 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from e24smtp05.br.ibm.com (HELO e24smtp05.br.ibm.com) (32.104.18.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Apr 2009 22:18:31 +0000 Received: from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16]) by e24smtp05.br.ibm.com (8.13.1/8.13.1) with ESMTP id n38MEOGK018943 for ; Wed, 8 Apr 2009 19:14:24 -0300 Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.18.232.47]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n38NHk6h3170310 for ; Wed, 8 Apr 2009 20:17:46 -0300 Received: from d24av02.br.ibm.com (loopback [127.0.0.1]) by d24av02.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n38MIPDO030481 for ; Wed, 8 Apr 2009 19:18:27 -0300 Received: from [9.8.10.215] ([9.8.10.215]) by d24av02.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n38MIPJt030471; Wed, 8 Apr 2009 19:18:25 -0300 Subject: Re: [RFC] problem with read_memory_string (reads 8 bytes at a time) From: Thiago Jung Bauermann To: Joel Brobecker Cc: gdb-patches@sourceware.org In-Reply-To: <20090408212609.GG7535@adacore.com> References: <20090408182650.GE7535@adacore.com> <1239217285.8871.90.camel@localhost.localdomain> <20090408212609.GG7535@adacore.com> Content-Type: text/plain; charset=utf-8 Date: Wed, 08 Apr 2009 22:18:00 -0000 Message-Id: <1239229104.8871.164.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit 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-04/txt/msg00163.txt.bz2 El mié, 08-04-2009 a las 14:26 -0700, Joel Brobecker escribió: > > I suggest using target_read_string. If I understand its code correctly, > > it handles the corner case you hit. > > Thanks for the tip! > > It looks like it does, indeed - although a little ineffectively: > Once it failed to read a 4byte block, it tries reading 1 byte. > If that works, then it tries 3bytes, which won't work again, > and thus try 1 byte one more time. If that works, then it'll read > 2 bytes, etc. I don't think this is a big deal, though. Well, it's not efficient for your case, but it's efficient for the case where three bytes out of a 4 byte "bite" were good. The next try will read those 3 bytes and off you go... > That being said, I am wondering why we have more than 1 routine > to read strings... Is there something we should do? Yes, I wondered the same when I was implementing LA_GET_STRING. I believe we can consolidate those routines. I just added a new item to the ProjectIdeas wiki page, under the "Internals" section. -- []'s Thiago Jung Bauermann IBM Linux Technology Center