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 BAA993858D28 for ; Wed, 25 Jan 2023 17:12:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BAA993858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca 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)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id E55B71E110; Wed, 25 Jan 2023 12:12:06 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1674666727; bh=stjNgmZgH6RyxeL7gLcpweBAiGVJMarm8Pw+uyJcQ6o=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Wlx1gNnTTQv6I7PTp+jM6YJ03mtfmJdkPqTX3SGFlzCqfKbPkpWT7FoCDlb2nVMQ8 pkCuAw7vMoX09B38eu0gxFSc6CoVpLrWDotM56QPEagQz4vIA05G6P+EZf8v9k3eR1 WBIo/TpYUzwpoDm7d2eCI/45iwQz/uhBmDy9mT4I= Message-ID: <4a2b3e01-570c-65e7-544f-924f0ff7576b@simark.ca> Date: Wed, 25 Jan 2023 12:12:06 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v3 2/2] gdb/arm: Use new dwarf2 function cache Content-Language: en-US To: Luis Machado , =?UTF-8?Q?Torbj=c3=b6rn_SVENSSON?= , gdb-patches@sourceware.org Cc: tom@tromey.com, Yvan Roux References: <20230119102948.3069226-1-torbjorn.svensson@foss.st.com> <20230119102948.3069226-2-torbjorn.svensson@foss.st.com> <801f740d-9186-52dc-5bd4-e3416f001c17@arm.com> From: Simon Marchi In-Reply-To: <801f740d-9186-52dc-5bd4-e3416f001c17@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,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 1/25/23 11:55, Luis Machado via Gdb-patches wrote: > On 1/19/23 10:29, Torbjörn SVENSSON wrote: >> v2 -> v3: >> No changes, just rebase. >> >> --- >> >> This patch resolves the performance issue reported in pr/29738 by >> caching the values for the stack pointers for the inner frame. By >> doing so, the impact can be reduced to checking the state and >> returning the appropriate value. >> >> Signed-off-by: Torbjörn SVENSSON >> Signed-off-by: Yvan Roux >> --- >> gdb/arm-tdep.c | 96 +++++++++++++++++++++++++++++++++----------------- >> 1 file changed, 64 insertions(+), 32 deletions(-) >> >> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c >> index 51ec5236af1..be7219ca66e 100644 >> --- a/gdb/arm-tdep.c >> +++ b/gdb/arm-tdep.c >> @@ -3964,6 +3964,18 @@ struct frame_base arm_normal_base = { >> arm_normal_frame_base >> }; >> +struct arm_dwarf2_prev_register_cache >> +{ >> + /* Cached value of the coresponding stack pointer for the inner frame. */ >> + CORE_ADDR sp; >> + CORE_ADDR msp; >> + CORE_ADDR msp_s; >> + CORE_ADDR msp_ns; >> + CORE_ADDR psp; >> + CORE_ADDR psp_s; >> + CORE_ADDR psp_ns; >> +}; >> + >> static struct value * >> arm_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache, >> int regnum) >> @@ -3972,6 +3984,48 @@ arm_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache, >> arm_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); >> CORE_ADDR lr; >> ULONGEST cpsr; >> + struct arm_dwarf2_prev_register_cache *cache >> + = (struct arm_dwarf2_prev_register_cache *) dwarf2_frame_get_fn_data ( >> + this_frame, this_cache, arm_dwarf2_prev_register); >> + >> + if (!cache) >> + { >> + const unsigned int size = sizeof (struct arm_dwarf2_prev_register_cache); >> + cache = (struct arm_dwarf2_prev_register_cache *) >> + dwarf2_frame_allocate_fn_data (this_frame, this_cache, > > Still some funny spacing above. Could you please check the patch again, just to be sure? To clarify, I would probably write the first part as: arm_dwarf2_prev_register_cache *cache = ((arm_dwarf2_prev_register_cache *) dwarf2_frame_get_fn_data (this_frame, this_cache, arm_dwarf2_prev_register)); The changes are: - dropping the struct keyword (unnecessary in C++) - the assigment operator is on the second line (mandated by GNU style) - the addition of parenthesis when breaking an expression (also mandated by GNU style, is it so that the following line(s) align nicely with the opening parenthesis) Similarly, the second one would be: cache = ((arm_dwarf2_prev_register_cache *) dwarf2_frame_allocate_fn_data (this_frame, this_cache, arm_dwarf2_prev_register, size); This is just how I would do it, there are probably other valid ways. Simon