From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 75AB03858C2C for ; Thu, 3 Feb 2022 12:36:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 75AB03858C2C 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 213CZjlU004302 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 3 Feb 2022 07:35:50 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 213CZjlU004302 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) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1301C1EDEE; Thu, 3 Feb 2022 07:35:45 -0500 (EST) Message-ID: <34fdb9a1-3c9c-c558-cbc5-5ac39a28185d@polymtl.ca> Date: Thu, 3 Feb 2022 07:35:44 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v4] gdb: add a symbol* argument to get_return_value Content-Language: en-US To: "Six, Lancelot" , "simark@simark.ca" Cc: "lsix@lancelotsix.com" , "gdb-patches@sourceware.org" References: <8ebbde37-0acc-c430-ea36-d21c14163ef8@simark.ca> <20220202215914.23534-1-lancelot.six@amd.com> From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 3 Feb 2022 12:35:45 +0000 X-Spam-Status: No, score=-3032.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_STOCKGEN, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Thu, 03 Feb 2022 12:36:57 -0000 On 2022-02-03 06:10, Six, Lancelot wrote: > [AMD Official Use Only] > >> Hi Lancelot, >> >> Every time I look I keep finding nits, sorry :( > > No worry. > >> I have the feeling that value_type is redundant with func_symbol, since the return value type initially comes from the symbol. So I think we could remove value_type. In fact, it might have been redundant already, since from `struct value *function`, you should also be able to get the function type. But there may be edge cases I don't know about. > > To be honest, I did have a similar impression about the function parameter. Once you have the function symbol, you should be able to get a value containing the function address, so this parameter is probably also redundant. The reason I did not make this change is because the function's address is obtained with a call to: > > struct value *function = read_var_value (func_symbol, NULL, frame); > > Moving this call within get_return_value might mean we use a different FRAME argument (get_current_frame ()). I do not expect it to change anything, but because I am not 100% sure, I did not change that. > >> Do you think this change below (that builds on top of your patch) would work? Tests gdb.*/*finish*.exp pass here. > > I'll probably try to remove both the value* and type* arguments and see if I have any regression (unless anyone is aware on some edge cases where this can be problematic). > > WDYT? I wouldn't get rid of the `value *` argument, as you said this is obtained using read_var_value and the current frame. So if we don't pass the `value *`, we would need to pass the frame, there's no point in doing that change. I'm just talking about removing the `type *` argument, which in both callers of get_return_value, is obtained using: TYPE_TARGET_TYPE (SYMBOL_TYPE (function)); where `function` is the struct symbol that we also pass to get_return_value. Simon