From patchwork Sat Nov 29 14:30:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 4010 Received: (qmail 17205 invoked by alias); 29 Nov 2014 14:30:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 17194 invoked by uid 89); 29 Nov 2014 14:30:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 29 Nov 2014 14:30:51 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1Xuj2u-00038G-OZ from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Sat, 29 Nov 2014 06:30:48 -0800 Received: from qiyao.dyndns.org.com (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.181.6; Sat, 29 Nov 2014 06:30:48 -0800 From: Yao Qi To: Subject: [committed, arm] compute framereg and framesize when needed Date: Sat, 29 Nov 2014 22:30:35 +0800 Message-ID: <1417271435-25216-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes I find local variables framereg and framesize is only used when cache isn't NULL. This patch to move the code into "if (cache)" block. It is obvious. I'll push it in. gdb: 2014-11-29 Yao Qi * arm-tdep.c (arm_analyze_prologue): Move local variables 'framereg' and 'framesize' to inner block. Move code to inner block too. --- gdb/ChangeLog | 6 ++++++ gdb/arm-tdep.c | 33 +++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 552c13b..c35f0ae 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2014-11-29 Yao Qi + + * arm-tdep.c (arm_analyze_prologue): Move local variables + 'framereg' and 'framesize' to inner block. Move code to + inner block too. + 2014-11-28 Siva Chandra Reddy * eval.c: Include gdbthread.h. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 1002870..7ec3bff 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1686,7 +1686,6 @@ arm_analyze_prologue (struct gdbarch *gdbarch, pv_t regs[ARM_FPS_REGNUM]; struct pv_area *stack; struct cleanup *back_to; - int framereg, framesize; CORE_ADDR unrecognized_pc = 0; /* Search the prologue looking for instructions that set up the @@ -1887,23 +1886,25 @@ arm_analyze_prologue (struct gdbarch *gdbarch, if (unrecognized_pc == 0) unrecognized_pc = current_pc; - /* The frame size is just the distance from the frame register - to the original stack pointer. */ - if (pv_is_register (regs[ARM_FP_REGNUM], ARM_SP_REGNUM)) - { - /* Frame pointer is fp. */ - framereg = ARM_FP_REGNUM; - framesize = -regs[ARM_FP_REGNUM].k; - } - else - { - /* Try the stack pointer... this is a bit desperate. */ - framereg = ARM_SP_REGNUM; - framesize = -regs[ARM_SP_REGNUM].k; - } - if (cache) { + int framereg, framesize; + + /* The frame size is just the distance from the frame register + to the original stack pointer. */ + if (pv_is_register (regs[ARM_FP_REGNUM], ARM_SP_REGNUM)) + { + /* Frame pointer is fp. */ + framereg = ARM_FP_REGNUM; + framesize = -regs[ARM_FP_REGNUM].k; + } + else + { + /* Try the stack pointer... this is a bit desperate. */ + framereg = ARM_SP_REGNUM; + framesize = -regs[ARM_SP_REGNUM].k; + } + cache->framereg = framereg; cache->framesize = framesize;