From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cCCmLbfQiGD/FwAAWB0awg (envelope-from ) for ; Tue, 27 Apr 2021 23:04:23 -0400 Received: by simark.ca (Postfix, from userid 112) id B90D41F11C; Tue, 27 Apr 2021 23:04:23 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DBFEE1E940 for ; Tue, 27 Apr 2021 23:04:22 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7906D381DCC8; Wed, 28 Apr 2021 03:04:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7906D381DCC8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1619579062; bh=S8sumPTK+q1XVT0twEtvLk7vOp6irSMYr7El59pW9tM=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WzYGWRmByjbQgCAWsYulD9Gv42puQ8Zl6+sOJcu4iQSc8kHTluQEehWwSm6JqlHLm DgiD0SdKnI7mvCREf66m13D+Fi92Q3Q4npbrmFU95eT/anU944HY88ADPlD4Yzidq/ /HOWf1a5yWdoLEOKVmeKuJqbjr4sjzXjKMVgWU0g= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 2C3D53854821 for ; Wed, 28 Apr 2021 03:04:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2C3D53854821 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 13S349Lc009729 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Apr 2021 23:04:14 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 13S349Lc009729 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id C2DA41E940; Tue, 27 Apr 2021 23:04:09 -0400 (EDT) Subject: Re: [PATCH 17/43] Add as_lval argument to expression evaluator To: Zoran Zaric , gdb-patches@sourceware.org References: <20210301144620.103016-1-Zoran.Zaric@amd.com> <20210301144620.103016-18-Zoran.Zaric@amd.com> Message-ID: Date: Tue, 27 Apr 2021 23:04:09 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210301144620.103016-18-Zoran.Zaric@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 28 Apr 2021 03:04:09 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" > @@ -929,6 +930,11 @@ dwarf_expr_context::fetch_result (struct type *type, > } > else > { > + /* If AS_LVAL is false, means that the implicit conversion > + from a location description to value is expected. */ > + if (as_lval == false) For booleans: !as_lval > diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h > index d1374068732..3f519e81849 100644 > --- a/gdb/dwarf2/expr.h > +++ b/gdb/dwarf2/expr.h > @@ -130,11 +130,13 @@ struct dwarf_expr_context > void push_address (CORE_ADDR value, bool in_stack_memory); > > /* Evaluate the expression at ADDR (LEN bytes long) in a given PER_CU > - FRAME context. Where TYPE, SUBOBJ_TYPE and SUBOBJ_OFFSET describe > - expected struct value representation of the evaluation result. > - The ADDR_INFO property can be specified to override the range of > - memory addresses with the passed in buffer. */ > - struct value *evaluate (const gdb_byte *addr, size_t len, > + FRAME context. AS_LVAL defines if the returned struct value is > + expected to be a value or a location description. Where TYPE, > + SUBOBJ_TYPE and SUBOBJ_OFFSET describe expected struct value > + representation of the evaluation result. The ADDR_INFO property > + can be specified to override the range of memory addresses with > + the passed in buffer. */ Especially when the comment starts getting long and there are many parameters, I think it helps readability to space it out a bit. Start with one sentence by itself that gives the high level description of what the method does. Then one paragraph per parameter (or group of parameters, if some are logically connected). So, something like: /* Evaluate the expression at ADDR (LEN bytes long) in a given PER_CU and FRAME context. AS_LVAL defines if the returned struct value is expected to be a value or a location description. TYPE, SUBOBJ_TYPE, SUBOBJ_OFFSET describe the expected struct value representation of the evaluation result. ... It would also be good to clarify for AS_LVAL which of true and false mean "a value" and "a location description". It's not clear to me. Simon