Re: [RFA] More tweaks to arm_skip_prologue

Richard Earnshaw
2002-04-23T09:44:06Z

>
> I know that some of these tweaks to arm_skip_prologue will also
> suggest similar tweaks to arm_scan_prologue. I'll do those next.
> Wouldn't it be nice if the two shared code? ;-)
>
> 2002-04-22 Michael Snyder <msnyder@redhat.com>
>
> * arm-tdep.c (arm_skip_prologue): Better handling for frameless
> functions. Treat "mov ip, sp" as optional. Recognize
> "str lr, [sp, #-nn]".
>
In principal OK, but see embedded notes.

> by disassembling the instructions. */
> skip_pc = pc;
> inst = read_memory_integer (skip_pc, 4);
> ! if (inst == 0xe1a0c00d) /* mov ip, sp */
> ! {
> ! skip_pc += 4;
> ! inst = read_memory_integer (skip_pc, 4);
> ! }

If the sequence doesn't start with mov ip, sp then we either have a
scheduled prologue where the first instruction is messing with
call-clobbered register, or we have a frameless prologue. I suspect that
if are in this situation then we should use a different unwind function to
keep things simpler.

>
> ! /* Some prologues begin with "str lr, [sp, #-nn]". */
> ! if ((inst & 0xffffff00) == 0xe52de000) /* str lr, [sp, #-nn] */
> {
> skip_pc += 4;
> inst = read_memory_integer (skip_pc, 4);
> }

This should only ever be "str lr, [sp, #-4]!" (note the writeback). What
about an "stmfd sp!, {...., lr}" (non-frame) prologue instruction.

>
> ! if ((inst & 0xfffffff0) == 0xe92d0000) /* stmfd sp!,{a1,a2,a3,a4} */
> ! {
> ! skip_pc += 4;
> ! inst = read_memory_integer (skip_pc, 4);
> ! }
>
> ! if ((inst & 0xfffff800) == 0xe92dd800) /* stmfd sp!,{fp,ip,lr,pc} */
> ! {
> ! skip_pc += 4;
> ! inst = read_memory_integer (skip_pc, 4);
> ! }
>

R.