From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55310 invoked by alias); 31 May 2017 14:30:47 -0000 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 Received: (qmail 55203 invoked by uid 89); 31 May 2017 14:30:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=longest, Hx-languages-length:1963, transfer, our X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 31 May 2017 14:30:35 +0000 Received: by simark.ca (Postfix, from userid 33) id 2B1DB1E4A4; Wed, 31 May 2017 10:30:37 -0400 (EDT) To: Andreas Arnez Subject: Re: [PATCH v2 17/19] Fix bit-/byte-offset mismatch in parameter to read_value_memory X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 31 May 2017 14:30:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: References: <1494352015-10465-1-git-send-email-arnez@linux.vnet.ibm.com> <1494352015-10465-18-git-send-email-arnez@linux.vnet.ibm.com> <3d3d77f7b369db28f50d388e54857a94@polymtl.ca> Message-ID: <50f1797b8d829ce960a26d84e6b17324@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.5 X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00634.txt.bz2 On 2017-05-31 16:02, Andreas Arnez wrote: > On Tue, May 30 2017, Simon Marchi wrote: > >> On 2017-05-09 19:46, Andreas Arnez wrote: >>> @@ -984,8 +984,9 @@ read_value_memory (struct value *val, LONGEST >>> embedded_offset, >>> if (status == TARGET_XFER_OK) >>> /* nothing */; >>> else if (status == TARGET_XFER_UNAVAILABLE) >>> - mark_value_bytes_unavailable (val, embedded_offset + xfered_total, >>> - xfered_partial); >>> + mark_value_bits_unavailable (val, (xfered_total * HOST_CHAR_BIT >>> + + bit_offset), >>> + xfered_partial * HOST_CHAR_BIT); >> >> Since it's readily available, please use the unit_size variable here >> instead of HOST_CHAR_BIT. > > Hm, I thought unit_size represents the number of *bytes* stored at the > same target address. But we need an offset in *bits* here. Maybe you > mean that xfered_total should have been multiplied by unit_size even > before my patch? Ah yes sorry, it should be "* unit_size * 8", since the unit size is specifically the number of 8-bit units. And yes, the multiplication with unit_size "should" have been there before. In our GDB port that uses 16-bit bytes, we don't really deal with unavailable bytes, so we haven't adapted that particular code. In the end, I don't really mind if you keep "* HOST_CHAR_BIT": if we ever need to deal with unavailable data on a non 8-bit bytes platform, we'll need to adjust many places, so it doesn't really matter if this one uses the unit size or not right now. You can forget about this comment :). > (Is it even correct that xfered_partial measures > addressable target units? Note that to_xfer_partial is documented to > "[...] transfer up to LEN 8-bit bytes of the target's OBJECT.") Yes that's the intent, and that's how it is in our GDB port. As for the documentation of to_xfer_partial, that's probably an oversight. target_read and target_write have the right doc. Simon