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 AC0473858D35 for ; Thu, 3 Feb 2022 19:27:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AC0473858D35 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 213JQ3c2000522 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 3 Feb 2022 14:26:08 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 213JQ3c2000522 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 645B11EDEE; Thu, 3 Feb 2022 14:26:03 -0500 (EST) Message-ID: <05b64605-7491-cdac-7ad8-ce3d7c1c245a@polymtl.ca> Date: Thu, 3 Feb 2022 14:26:02 -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 v5] gdb: add a symbol* argument to get_return_value Content-Language: en-US To: Lancelot SIX , gdb-patches@sourceware.org Cc: lsix@lancelotsix.com, simark@simark.ca References: <20220203182821.20793-1-lancelot.six@amd.com> From: Simon Marchi In-Reply-To: <20220203182821.20793-1-lancelot.six@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 3 Feb 2022 19:26:03 +0000 X-Spam-Status: No, score=-3039.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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 19:27:16 -0000 > diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c > index 03bd4934506..2298c179ba8 100644 > --- a/gdb/python/py-finishbreakpoint.c > +++ b/gdb/python/py-finishbreakpoint.c > @@ -40,13 +40,15 @@ struct finish_breakpoint_object > { > /* gdb.Breakpoint base class. */ > gdbpy_breakpoint_object py_bp; > - /* gdb.Type object of the value return by the breakpointed function. > - May be NULL if no debug information was available or return type > - was VOID. */ > - PyObject *return_type; > - /* gdb.Value object of the function finished by this breakpoint. Will be > - NULL if return_type is NULL. */ > + > + /* gdb.Symbol object of the function finished by this breakpoint. */ > + PyObject *func_symbol; > + > + /* gdb.Value object of the function finished by this breakpoint. > + > + nullptr if no debug information was available or return type was VOID. */ > PyObject *function_value; Actually I would mention the "nullptr if no debug..." part in func_symbol's documentation as well, since in the code we do check whether func_symbol is nullptr. LGTM with that fixed. And I have a question I didn't bring up before, because I don't want to increase the scope of this patch, but I am asking just for the sake of discussing. Do you know why we wrapped return_type, and now func_symbol, in Python objects? Any reason why we don't save the struct type / struct symbol pointer directly? To protect against the underlying object disappearing while the FinishBreakpoint exists, maybe? Simon