This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[committed, arm] compute framereg and framesize when needed
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Sat, 29 Nov 2014 22:30:35 +0800
- Subject: [committed, arm] compute framereg and framesize when needed
- Authentication-results: sourceware.org; auth=none
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 <yao@codesourcery.com>
* 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 <yao@codesourcery.com>
+
+ * 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 <sivachandra@google.com>
* 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;
--
1.9.3