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

Per Fransson per.fransson.ml at gmail.com
Thu Oct 6 14:57:06 UTC 2011


On Thu, Oct 6, 2011 at 2:53 PM, Dave Anderson <anderson at redhat.com> wrote:
>
>
> ----- Original Message -----
>> 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
>
> I can't comment on the backtrace functionality/query, but the patch
> looks reasonable -- although it appears that with the current code,
> as is, it would only affect CRASHDEBUG(5) output in unwind_frame()?
>
> Dave
>
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
>

It's used to set ctrl.vrs[FP] in unwind_frame(). A pointer to ctrl is
passed to unwind_exec_insn(), which might use it as the sp for
the preceding frame.

Regards,
Per




More information about the Crash-utility mailing list