From patchwork Mon Jul 27 21:46:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 7878 Received: (qmail 46075 invoked by alias); 27 Jul 2015 21:46:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 46065 invoked by uid 89); 27 Jul 2015 21:46:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 27 Jul 2015 21:46:10 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id 1C.F1.12958.17A46B55; Mon, 27 Jul 2015 17:12:50 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.86) with Microsoft SMTP Server id 14.3.210.2; Mon, 27 Jul 2015 17:46:07 -0400 Message-ID: <55B6A69F.5010205@ericsson.com> Date: Mon, 27 Jul 2015 17:46:07 -0400 From: Simon Marchi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Pedro Alves , Subject: Re: [PATCH 2/5] Update comments in struct value for non-8-bits architectures References: <1437072684-26565-1-git-send-email-simon.marchi@ericsson.com> <1437072684-26565-2-git-send-email-simon.marchi@ericsson.com> <55B22109.5020500@redhat.com> In-Reply-To: <55B22109.5020500@redhat.com> X-IsSubscribed: yes On 15-07-24 07:27 AM, Pedro Alves wrote: > On 07/16/2015 07:51 PM, Simon Marchi wrote: >> gdb/ChangeLog: >> >> * value.c (struct value): Update comments. > > Looks good to me, though as mentioned in the other patch, I think > these comments should be explicit in saying "host" and "target". These are > central structures that people study first, and being crystal clear > should help grasp the byte vs memory units concepts sooner. > > Thanks, > Pedro Alves Updated version: From 4441bdcc4e55d2397d2ca7918669a1ccf1676a25 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 2 Jul 2015 17:52:40 -0400 Subject: [PATCH] Update comments in struct value for non-8-bits architectures gdb/ChangeLog: * value.c (struct value): Update comments. --- gdb/value.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/gdb/value.c b/gdb/value.c index 4399493..7fb7e2b 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -234,11 +234,11 @@ struct value } computed; } location; - /* Describes offset of a value within lval of a structure in bytes. - If lval == lval_memory, this is an offset to the address. If - lval == lval_register, this is a further offset from - location.address within the registers structure. Note also the - member embedded_offset below. */ + /* Describes offset of a value within lval of a structure in target + addressable memory units. If lval == lval_memory, this is an offset to + the address. If lval == lval_register, this is a further offset from + location.address within the registers structure. Note also the member + embedded_offset below. */ int offset; /* Only used for bitfields; number of bits contained in them. */ @@ -291,19 +291,19 @@ struct value When we store the entire object, `enclosing_type' is the run-time type -- the complete object -- and `embedded_offset' is the - offset of `type' within that larger type, in bytes. The - value_contents() macro takes `embedded_offset' into account, so - most GDB code continues to see the `type' portion of the value, - just as the inferior would. + offset of `type' within that larger type, in target addressable memory + units. The value_contents() macro takes `embedded_offset' into account, + so most GDB code continues to see the `type' portion of the value, just + as the inferior would. If `type' is a pointer to an object, then `enclosing_type' is a pointer to the object's run-time type, and `pointed_to_offset' is - the offset in bytes from the full object to the pointed-to object - -- that is, the value `embedded_offset' would have if we followed - the pointer and fetched the complete object. (I don't really see - the point. Why not just determine the run-time type when you - indirect, and avoid the special case? The contents don't matter - until you indirect anyway.) + the offset in target addressable memory units from the full object + to the pointed-to object -- that is, the value `embedded_offset' would + have if we followed the pointer and fetched the complete object. + (I don't really see the point. Why not just determine the + run-time type when you indirect, and avoid the special case? The + contents don't matter until you indirect anyway.) If we're not doing anything fancy, `enclosing_type' is equal to `type', and `embedded_offset' is zero, so everything works