[Crash-utility] [PATCH] ARM: fp when unwinding

Per Fransson per.xx.fransson at stericsson.com
Thu Oct 6 11:04:07 UTC 2011


Hi Dave, Mika, Jan and anyone else interested in the Crash ARM support,

The table based unwind code potentially unwinds the stack pointer to the 
existing value of any other register except the PC:

	} else if ((insn & 0xf0) == 0x90 &&
		   (insn & 0x0d) != 0x0d) {
		/* 1001 nnnn: set vsp = r[nnnn] */
		ctrl->vrs[SP] = ctrl->vrs[insn & 0x0f];

  The 'struct stackframe' we use to keep unwind state when going from 
one frame to the next (or should I say previous) only contains fp, sp, 
lr and pc, which might be something we should consider changing. Even as 
it stands however, frame.fp is assigned an incorrect value for active 
tasks. Here's a patch to fix that.


diff --git a/unwind_arm.c b/unwind_arm.c
index fd6ac65..6554804 100644
--- a/unwind_arm.c
+++ b/unwind_arm.c
@@ -710,6 +710,7 @@ unwind_backtrace(struct bt_info *bt)
          */
         if (bt->machdep) {
                 const struct arm_pt_regs *regs = bt->machdep;
+               frame.fp = regs->ARM_fp;
                 frame.lr = regs->ARM_lr;
         }


And this time I did remember to run a 'make warn' =o)

Regards,
Per




More information about the Crash-utility mailing list