From patchwork Fri Nov 4 14:44:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Torbjorn SVENSSON X-Patchwork-Id: 55263 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EAB0E38582B3 for ; Fri, 4 Nov 2022 14:45:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAB0E38582B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667573133; bh=zrmfHQdEx+uVJzHaPpkl5f5IvsgiAEDZtg+b1eP6Npg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=gszflnRIItgSg2N/2mxwB0GiUoOydqy1pQ44vzVlq491ld0s3ucYhQOBoCSX/vKFe 102+w35DxRcqJymmntP1P/hbYmUfHrlgW8YmPE8Oo/tOp74eMjwx9guwgQb742Lltk +5DAhDJPvC/DRcgdXC0P9NQYg70V6gMgdYkKszno= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id C9FAA3858C2B for ; Fri, 4 Nov 2022 14:45:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C9FAA3858C2B Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2A4ENPO4027271; Fri, 4 Nov 2022 15:45:05 +0100 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 3kn0kmsr5c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Nov 2022 15:45:05 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D6BF4100034; Fri, 4 Nov 2022 15:45:00 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id CD7E721FE9E; Fri, 4 Nov 2022 15:45:00 +0100 (CET) Received: from jkgcxl0002.jkg.st.com (10.210.54.218) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:44:58 +0100 To: Subject: [PATCH 0/3] gdb/arm: Fixes for Cortex-M stack unwinding Date: Fri, 4 Nov 2022 15:44:35 +0100 Message-ID: <20221104144438.2786801-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.210.54.218] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_09,2022-11-03_01,2022-06-22_01 X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, 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 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-Patchwork-Original-From: =?utf-8?q?Torbj=C3=B6rn_SVENSSON_via_Gdb-patches?= From: Torbjorn SVENSSON Reply-To: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= Cc: vanekt@volny.cz Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Hi, This patchset attempts to attack the issues reported in pr/29716 and pr/29738. Based on my testing on a STM32L552 with TrustZone, it appears to work as expected, but I'd love to have another set of eyes on this! Most of the items reported can be seen using the GTZC example from ST: https://github.com/STMicroelectronics/STM32CubeL5/tree/master/Projects/NUCLEO-L552ZE-Q/Examples/GTZC/GTZC_TZSC_MPCBB_TrustZone I've manually verfied the register content by setting break points in * main * Error_Handler * SecureFault_Handler For the dwarf2 problem in pr/29738, I added 7-chained functions like below and placed a breakpoint at myfunc7: void myfunc7() { HAL_Delay(1); } ... void myfunc1() { HAL_Delay(1); myfunc2(); } For each breakpoint, I then used the below macros to print the registers. For each of the printed frames, I then manually checked if the values maked sense. define show_reg shell printf "%-8s " '$arg0' p/x $arg0 end define show_stacks shell echo shell echo -e "\x1b[35mContent at $arg0\x1b[0m" bt set $i = 0 while $i <= $arg1 f $i show_reg $lr show_reg $pc show_reg $sp show_reg $msp show_reg $msp_s show_reg $msp_ns show_reg $psp show_reg $psp_s show_reg $psp_ns shell echo set $i = $i + 1 end shell echo shell echo end The show_stacks macro takes 2 arguments, a description and the number of frames to print registers for. To show the registers for all the frames when at the Error_Handler breakpoint, I used: show_stacks "Error_Handler" 7 With this series applied, I've not been able to reproduce the stack trace shown in comment 0 in pr/29716. I'm not sure if the series fixes the issue, or if it still there but I'm doing something wrong. Kind regards, Torbjörn