From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id y6VIDc5OB2TJdQcAWB0awg (envelope-from ) for ; Tue, 07 Mar 2023 09:48:46 -0500 Received: by simark.ca (Postfix, from userid 112) id 282771E128; Tue, 7 Mar 2023 09:48:46 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=XAIFycUT; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.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 CF8E21E128 for ; Tue, 7 Mar 2023 09:48:45 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3432938582A3 for ; Tue, 7 Mar 2023 14:48:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3432938582A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678200525; bh=gXIV07Kat2tzOtHljknQe3Ye6iqFWgy0rDMvhDU0IAQ=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=XAIFycUT/o633p64fbSc9rX0F6ThRE3+bUyhLAEnVtstQA/+GHgrbcWA30Fj6QHX3 AJDGwkFzxbRM0O3dmvlia5dEaIKiJb/eAZbwNaKi9FEvruGEzgSSHgV66UDDQBvIWh 0s9I76IkDT2JtyU5F00DSBTlBtCJn+9ykN9nnBmw= 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 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 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> 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-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+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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