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 B4BE53858D3C for ; Tue, 7 Mar 2023 14:48:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B4BE53858D3C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca 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 327ElGoC029018 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 7 Mar 2023 09:47:21 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 327ElGoC029018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1678200442; bh=gXIV07Kat2tzOtHljknQe3Ye6iqFWgy0rDMvhDU0IAQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=JzSxYCxDYWiZ/g13klAEKKJ5nyO8twvar16qxIHlxRqgIZ4HerIy7ibSmWwKQfD4X RpmeB278t0ThjsR5XcicrXqnLKZZyjTQ+xOPZMcXjsOx2mErkpiBU/E2OY30Sk15hW jNsL4/jxv/tGrtee7uLfb9IMN1C/weU+omtKNnvM= Received: from [10.0.0.11] (unknown [217.28.27.60]) (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 2F46A1E128; Tue, 7 Mar 2023 09:47:16 -0500 (EST) Message-ID: <5f905345-15a1-d7e0-f8b5-221997fcd1ac@polymtl.ca> Date: Tue, 7 Mar 2023 09:47:15 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] gdb/amdgpu: provide dummy implementation of gdbarch_return_value_as_value Content-Language: en-US To: Lancelot SIX Cc: gdb-patches@sourceware.org References: <20230306214650.1744872-1-simon.marchi@polymtl.ca> <20230307104556.6irap5z2epv7ppxq@ubuntu.lan> From: Simon Marchi In-Reply-To: <20230307104556.6irap5z2epv7ppxq@ubuntu.lan> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 7 Mar 2023 14:47:16 +0000 X-Spam-Status: No, score=-3031.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 3/7/23 05:45, Lancelot SIX wrote: > Hi Simon, > >> +/* Dummy implementation of gdbarch_return_value_as_value. */ >> + >> +static return_value_convention >> +amdgpu_return_value_as_value (gdbarch *arch, value *function, type *valtype, >> + regcache *regcache, value **read_value, >> + const gdb_byte *writebuf) >> +{ >> + gdb_assert_not_reached ("not implemented"); > > Isn't "error" more appropriate here? We just need to indicate that the > current hook failed. GDB is not in an inconsistent state. In my original patch, I made these hooks optional, and added some predicate checks: if (!gdbarch_return_value_as_value_p (gdbarch)) error_arch_no_return_value (gdbarch); The feedback was that throwing errors at some of these places (like during event handling) would probably put GDB in a bad state. Erroring out of amdgpu_return_value_as_value would be the same. > > Maybe another approach could be to add an elem to the > return_value_convention like RETURN_VALUE_UNKNOWN which could be a > reasonable default if the gdbarch does not know how to handle a given > type. I think that Pedro hinted that we would need this anyway at some point, for functions that don't follow a defined ABI. So, I think it would make sense, but we need to update the core of GDB to handle that response. And I'm not too familiar with this area, so I don't know how much work this represents. But if we know we're going to need this anyway, I might as well give it a shot. > Anyway, I do not think that you can easily reach this point with the > current port of amdgcn. The `return`, `finish` and `call` commands will > produce errors before reaching this point. Yes, that's my experience. The AMD GPU port upstream is too barebones to use these commands. And it's just temporary. Simon