From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id 71B9A3870863 for ; Mon, 16 May 2022 13:59:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 71B9A3870863 Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24GCkK50019063 for ; Mon, 16 May 2022 15:59:37 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3g21ukj24e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 16 May 2022 15:59:37 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 101DF10002A for ; Mon, 16 May 2022 15:59:37 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 0A9632291D0 for ; Mon, 16 May 2022 15:59:37 +0200 (CEST) Received: from gnbcxd0114.gnb.st.com (10.75.127.47) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Mon, 16 May 2022 15:59:36 +0200 Date: Mon, 16 May 2022 15:59:35 +0200 From: Yvan Roux To: CC: Torbjorn Svensson Subject: [PATCH 2/3] gdb/arm: Fetch initial sp value prior to compare Message-ID: <20220516135935.GC27993@gnbcxd0114.gnb.st.com> References: <20220516135454.GA27993@gnbcxd0114.gnb.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220516135454.GA27993@gnbcxd0114.gnb.st.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-16_13,2022-05-16_02,2022-02-23_01 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, 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 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: , X-List-Received-Date: Mon, 16 May 2022 13:59:39 -0000 For Arm Cortex-M33 with security extensions, there are 4 different stacks pointers (msp_s, msp_ns, psp_s, psp_ns). In order to identify the active one, compare the values of the different stacks. The value of the initla sp register needs to be fetched to perform this comparison. Signed-off-by: Torbjörn SVENSSON Signed-off-by: Yvan Roux --- gdb/arm-tdep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index c37254c2ce1..4aa277f5bc8 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -341,6 +341,7 @@ arm_cache_init (struct arm_prologue_cache *cache, struct frame_info *frame) arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch); arm_cache_init (cache, gdbarch); + cache->sp = get_frame_register_unsigned (frame, ARM_SP_REGNUM); if (tdep->have_sec_ext) { -- 2.17.1