From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23861 invoked by alias); 22 Sep 2014 18:16:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23851 invoked by uid 89); 22 Sep 2014 18:16:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 22 Sep 2014 18:16:44 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8MIGdHc028128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 22 Sep 2014 14:16:40 -0400 Received: from localhost (dhcp-10-15-16-169.yyz.redhat.com [10.15.16.169]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8MIGd7V016689 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Mon, 22 Sep 2014 14:16:39 -0400 From: Sergio Durigan Junior To: Jon Burgess Cc: gdb-patches@sourceware.org Subject: Re: [RFC][PATCH] arm-tdep.c (arm_m_exception_cache): Handle stack switching to PSP during exception unwind. References: <1411253227.22117.27.camel@shark.nightingale.homedns.org> X-URL: http://www.redhat.com Date: Mon, 22 Sep 2014 18:16:00 -0000 In-Reply-To: <1411253227.22117.27.camel@shark.nightingale.homedns.org> (Jon Burgess's message of "Sat, 20 Sep 2014 23:47:07 +0100") Message-ID: <87iokfzfjt.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00666.txt.bz2 On Saturday, September 20 2014, Jon Burgess wrote: > This my first GDB patch submission and I have not been through this FSF > copyright assignment process. Hi Jon, Thanks for the patch. I can submit the necessary form offlist so that you can get started in the process of obtaining the copyright assignment process. Meanwhile, here goes a non-technical review, which is meant to fix formatting issues. > 2014-09-20 Jon Burgess > > * arm-tdep.c (arm_m_exception_cache): Handle stack switching > to PSP during exception unwind. This is almost perfect; the only thing missing is that the entry need to be indented with TAB instead of spaces. Take a look at the gdb/ChangeLog file for examples. > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c > index 5cdfc5b..66a0ae8 100644 > --- a/gdb/arm-tdep.c > +++ b/gdb/arm-tdep.c > @@ -3010,6 +3010,7 @@ arm_m_exception_cache (struct frame_info > *this_frame) > struct gdbarch *gdbarch = get_frame_arch (this_frame); > enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); > struct arm_prologue_cache *cache; > + CORE_ADDR this_pc = get_frame_pc (this_frame); > CORE_ADDR unwound_sp; > LONGEST xpsr; > > @@ -3019,6 +3020,24 @@ arm_m_exception_cache (struct frame_info > *this_frame) > unwound_sp = get_frame_register_unsigned (this_frame, > ARM_SP_REGNUM); > > + /* The EXC_RETURN address indicates what type of transition > + the CPU makes when returning from the exception. A value > + of 0xfffffffd causes the stack pointer to switch from > + MSP to PSP. */ Two spaces after dot. /* The EXC_RETURN address indicates what type of transition the CPU makes when returning from the exception. A value of 0xfffffffd causes the stack pointer to switch from MSP to PSP. */ > + if (this_pc == 0xfffffffd) { > + int pspreg; > + struct regcache *regcache; > + struct value *pspval; > + > + pspreg = user_reg_map_name_to_regnum (gdbarch, "psp", 3); > + gdb_assert (pspreg != -1); > + > + regcache = get_current_regcache (); > + pspval = regcache_cooked_read_value (regcache, pspreg); > + if (pspval && !value_lazy (pspval)) > + unwound_sp = value_as_address (pspval); > + } The GNU Coding Style says that the open/close brackets should be indented one line below and two whitespaces after the "if" column, so it would be: if (this_pc == 0xfffffffd) { int pspreg; struct regcache *regcache; struct value *pspval; pspreg = user_reg_map_name_to_regnum (gdbarch, "psp", 3); gdb_assert (pspreg != -1); regcache = get_current_regcache (); pspval = regcache_cooked_read_value (regcache, pspreg); if (pspval && !value_lazy (pspval)) unwound_sp = value_as_address (pspval); } Also, if a line has 8 whitespaces, they have to be converted to a TAB char (but this is not the case here). > + > /* The hardware saves eight 32-bit words, comprising xPSR, > ReturnAddress, LR (R14), R12, R3, R2, R1, R0. See details in > "B1.5.6 Exception entry behavior" in Cheers, -- Sergio GPG key ID: 0x65FC5E36 Please send encrypted e-mail if possible http://sergiodj.net/