From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WMSjNHvM+2H8fgAAWB0awg (envelope-from ) for ; Thu, 03 Feb 2022 07:37:15 -0500 Received: by simark.ca (Postfix, from userid 112) id CF9641F3BA; Thu, 3 Feb 2022 07:37:15 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_MSPIKE_H2,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 00B8B1EDEE for ; Thu, 3 Feb 2022 07:37:15 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 486FA3858037 for ; Thu, 3 Feb 2022 12:37:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 486FA3858037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643891834; bh=/YbGr0vwgby5bTC52EsEeZjdriB5CoIENbWyMMudkRo=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=AnpyMltjuJktg4C1hFO4fJhiKRKeqm4ILxS/XHaCshnPIPnmEx2oPx9uvuT49sJU4 8v88MxpINdPK2iIO3JAUMB14bmTmT6H6p9Pygt6XPbfNmiMGD6o7QV7VJuW93V482n cbbEhRNCUZKy0Qcr3gbQnKz0GRaH0UpZef4my/9g= 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" References: <8ebbde37-0acc-c430-ea36-d21c14163ef8@simark.ca> <20220202215914.23534-1-lancelot.six@amd.com> 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-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 Cc: "lsix@lancelotsix.com" , "gdb-patches@sourceware.org" Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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