Re: [RFA] More tweaks to arm_skip_prologue

Michael Snyder
2002-04-23T17:54:57Z

> >
> > 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.

You know way more about the architecture than I do, but
check arm_scan_prologue -- it already does the same thing.
I'd like to bring them into sync, and then think about
possibly making them smarter.

>
> >
> > ! /* 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).

OK, I'll correct that.

> What about an "stmfd sp!, {...., lr}" (non-frame) prologue instruction.

Can you give me a pattern to match for?
I haven't actually seen that instruction in a prologue.