From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id LQipIL1b/mNU1wAAWB0awg (envelope-from ) for ; Tue, 28 Feb 2023 14:53:33 -0500 Received: by simark.ca (Postfix, from userid 112) id 789D51E222; Tue, 28 Feb 2023 14:53:33 -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=HhD/JfOH; 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=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 16F811E110 for ; Tue, 28 Feb 2023 14:53:33 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E2713858D3C for ; Tue, 28 Feb 2023 19:53:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E2713858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677614012; bh=2dG/7ZjRafKhiPkDhgj6yfbWPWeBaucJWyhprWRvSOI=; 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=HhD/JfOHnXmLPC5OqLeACW4xLk8+1fYNBLV6cVtLZFovxYeyvAPZCcyw4FmVSKqPT mtgXhmRlvO806TkCa1F3X/vNstGCmGklRkH+FQAjmNW53Nw6KONKyjKOTusutw1Kej BtNKnJsbMIEm5iwj7a0bRFJYHTwZKliVryADnGBg= Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 948183858D33 for ; Tue, 28 Feb 2023 19:53:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 948183858D33 Received: from [172.16.0.192] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (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 C31761E110; Tue, 28 Feb 2023 14:53:04 -0500 (EST) Message-ID: Date: Tue, 28 Feb 2023 14:53:04 -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: error out if architecture does not implement any "return_value" hook Content-Language: fr To: Andrew Burgess , Simon Marchi via Gdb-patches Cc: Simon Marchi References: <20230227212806.68474-1-simon.marchi@efficios.com> <87fsapj13v.fsf@redhat.com> In-Reply-To: <87fsapj13v.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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" >> diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py >> index caa65c334eca..7ceecbf5d223 100644 >> --- a/gdb/gdbarch_components.py >> +++ b/gdb/gdbarch_components.py >> @@ -902,11 +902,11 @@ for instance). >> ("struct value **", "read_value"), >> ("const gdb_byte *", "writebuf"), >> ], >> - predefault="default_gdbarch_return_value", >> # If we're using the default, then the other method must be set; >> # but if we aren't using the default here then the other method >> # must not be set. > > I don't think this comment aligns with the postdefault code. It says > "If we're using the default, ..." but "we" here is > 'return_value_as_value', but we're actually checking 'return_value'. Oops, I should have removed it probably. >> - invalid="(gdbarch->return_value_as_value == default_gdbarch_return_value) == (gdbarch->return_value == nullptr)", >> + postdefault="gdbarch->return_value != nullptr ? default_gdbarch_return_value : nullptr", > > If you search for the postdefault string you'll notice this code is not > actually generated anywhere! This is a consequence of also having > defined a predicate. Wow, that's bad! I really thought it was generated, maybe it was when trying some other combination of attributes. > As I say above, the gdbarch.py algorithm could do with some updating in > a few cases. > > The good news is, I already have a patch that fixes this problem. I was > going to include a link to it here, but turns out I never actually > posted it! I'm going to try to get that post on the list today, I've > tried it locally, and with my patch your postdefault code is generated > correctly. Thanks a lot. I agree with pretty much all you said above. I think a GDB port could live without a "return value" hook, but again there might be no point for us to support that extra complexity. I'll go look at your series. Simon Simon