From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119650 invoked by alias); 22 Nov 2016 18:29:52 -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 119640 invoked by uid 89); 22 Nov 2016 18:29:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2252, solely, hey X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Nov 2016 18:29:51 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A86D804F3; Tue, 22 Nov 2016 18:29:50 +0000 (UTC) Received: from [127.0.0.1] (ovpn03.gateway.prod.ext.phx2.redhat.com [10.5.9.3]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAMITmcM020384; Tue, 22 Nov 2016 13:29:49 -0500 Subject: Re: [PATCH 1/3] New function value_has_address To: Ulrich Weigand References: <20161122181616.118F810B923@oc8523832656.ibm.com> Cc: Joel Brobecker , Yao Qi , gdb-patches@sourceware.org From: Pedro Alves Message-ID: Date: Tue, 22 Nov 2016 18:29:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161122181616.118F810B923@oc8523832656.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-11/txt/msg00651.txt.bz2 On 11/22/2016 06:16 PM, Ulrich Weigand wrote: > Pedro Alves wrote: >> On 11/22/2016 04:50 PM, Joel Brobecker wrote: >>> Hey Yao, >>> >>>> +/* Return true if VALUE has address, otherwise return false. */ >>>> + >>>> +static int >>>> +value_has_address (const struct value *value) >>>> +{ >>>> + return (value->lval != lval_internalvar >>>> + && value->lval != lval_internalvar_component >>>> + && value->lval != lval_xcallable); >>> >>> I'm wondering about the function's name. Does a value that >>> lives in a register, for instance, really have an address? >>> For me, if there was a function value_has_address, it would >>> return nonzero only for lval_memory. I'm not too sure if >>> lval_computed would qualify or not. >>> >>> Perhaps, what you were looking for, is something like >>> value_lives_in_inferior? >> >> The intention of the function is to return true if the value >> uses the value.location.address union field as location: >> >> /* Location of value (if lval). */ >> union >> { >> /* If lval == lval_memory, this is the address in the inferior. >> If lval == lval_register, this is the byte offset into the >> registers structure. */ >> CORE_ADDR address; >> ... >> } location; >> >> I think that it's good that the names match. If one is renamed, >> so should the other, IMO. Maybe call the function >> value_has_address_location? I think it'd be good if the >> function's intro comment made this link more explicit. >> Actually, I see now that patch #3 tweaks the comment. > > I think part of the confusion is that the comment above is simply > no longer true; for lval_register values, address is *not* (any longer) > used to hold any byte offset into a register structure, as far as I > can see. Curious. Even better then. > Instead, for lval_register values, the register that holds > the value is identifed solely via the VALUE_REGNUM/VALUE_NEXT_FRAME_ID > fields, and the address field is ignored. > > I think we should reword the comments to reflect the fact that > "address" is only used for lval_address. On the other hand, > the regnum/frame_id fields should move into the union and only > be used for lval_register values ... That makes sense to me. Thanks, Pedro Alves