From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 116113858D33 for ; Fri, 22 Dec 2023 16:53:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 116113858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 116113858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703263990; cv=none; b=r0NP3qqJTf5tp5Ua/GWcY/G46xddZMCXEwGnFJySoop9ybK0d4M/4E7cINt+Fr9lScOWEZx3WJmnd+dUNW6VJoVMHK6bQw4e2O118IcdUnvu/9gB9l+341dCVn+k4s70Ep1Sph2xKUBpKq21oTchOhyNVZY4P8mz9ziHGjWWkLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703263990; c=relaxed/simple; bh=ID825fvzN2NeRPNLn9l2bX7K9R9eU21nV0mqCTQm3hI=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=uBPjInAIG65ioZt/I9sBZ3QwOpA9j6KBGKjjbJ//axzoLymJDtc4sECX7l1qDQhtZ6LilsA102NKV5OUNLgdBI6RUr99BA9xVvxmByq6kH3ccuPF5KVrlysuOyrf4c/m3kZ4hVvCRisKXtZ+A/VXjB4P9jGZsav6AbBgdIozK0U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1703263988; bh=ID825fvzN2NeRPNLn9l2bX7K9R9eU21nV0mqCTQm3hI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=aDFizqDYj/HW62ObqeZlJ4KIERtEKo3pTc9QH0yzkM43cBRgy8P17g1BLvmPtkWIS TRDy+NVxpm+7uFtcLdyLO9zXwxUwrJ3yVmLnV93ybBLITPCLMgkUJmMq0UJMWSjtAv Z8MlL9tPLhmYr/SH5XmIOW339YGr3P9CpFewO+nk= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 8BF5F1E0AC; Fri, 22 Dec 2023 11:53:08 -0500 (EST) Message-ID: <184fe643-5380-41a3-9f92-1eabc6ba61ef@simark.ca> Date: Fri, 22 Dec 2023 11:53:08 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/9] gdb: pass frame_info_ptr to gdbarch_value_from_register Content-Language: en-US To: Tom Tromey , Simon Marchi Cc: gdb-patches@sourceware.org References: <20231221191716.257256-1-simon.marchi@efficios.com> <20231221191716.257256-3-simon.marchi@efficios.com> <87jzp6198t.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87jzp6198t.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 2023-12-22 11:40, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> Pass a frame_info_ptr rather than a frame_id. This avoids having to do > Simon> a frame lookup on the callee side, when we can just pass the frame down > Simon> directly. > > Simon> I think this fixes a bug in rs6000-tdep.c where the id of the wrong > Simon> frame was set to `VALUE_NEXT_FRAME_ID (v)`. > > Simon> +value * > Simon> +default_value_from_register (gdbarch *gdbarch, type *type, int regnum, > Simon> + frame_info_ptr this_frame) > > FWIW I tend to think new code should use 'const frame_info_ptr &' in > most places. It's more efficient and the design of frame_info_ptr also > makes it harmless, as the underlying frame_info member is mutable. I initially thought that frame_info_ptr would be a thin enough wrapper that it would be better to pass it by value, but I see that it's 64 bytes long, so I guess you're right. I'll change my patches, but we should probably change the existing code too. It will also appease a frustration I had, where passing a frame_info_ptr down to a function would call the copy constructor. So, trying to step into that function would first step into the frame_info_ptr constructor first. I tried to add some skips for that in gdb-gdb.gdb, but I wasn't very successful (I didn't try very hard though). Simon