From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7558 invoked by alias); 8 Apr 2009 21:26:24 -0000 Received: (qmail 7542 invoked by uid 22791); 8 Apr 2009 21:26:23 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Apr 2009 21:26:17 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 773D82BAC33; Wed, 8 Apr 2009 17:26:15 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Fm4epw72nCTP; Wed, 8 Apr 2009 17:26:15 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 757132BAC24; Wed, 8 Apr 2009 17:26:14 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id ED0B4F5A13; Wed, 8 Apr 2009 14:26:09 -0700 (PDT) Date: Wed, 08 Apr 2009 21:26:00 -0000 From: Joel Brobecker To: Thiago Jung Bauermann Cc: gdb-patches@sourceware.org Subject: Re: [RFC] problem with read_memory_string (reads 8 bytes at a time) Message-ID: <20090408212609.GG7535@adacore.com> References: <20090408182650.GE7535@adacore.com> <1239217285.8871.90.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1239217285.8871.90.camel@localhost.localdomain> User-Agent: Mutt/1.5.18 (2008-05-17) 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/msg00159.txt.bz2 > 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. That being said, I am wondering why we have more than 1 routine to read strings... Is there something we should do? (I will change my code to use target_read_string for now - this won't help testing the case were we cross a boundary because the \0 is byte 0 of the last 4 bytes of my section, and that section is 4bytes- aligned). -- Joel