Re: Unwinding dummy frames on the i386

Andrew Cagney
2003-03-08T15:20:21Z

> Date: Fri, 07 Mar 2003 17:13:24 -0500
> From: Andrew Cagney <ac131313@redhat.com>
>
> > For now I've worked around this by having my own do-nothing
> > i386_save_dummy_frame_tos(), and having i386_unwind_dummy_id() return
> > contents of the (saved) frame pointer register for the frame's base.
> > Is there a better way to solve this?
>
> Can i386_save_dummy_frame_tos() save the `frame pointer register' that
> the unwind_dummy_id() method later returns?
>
> If reading the current value of FP_REGNUM from current_regcache is OK
> the answer is yes.

Yes. Just add a comment to gdbarch.sh saying that tos's successor needs
to be explicitly parameterized with the new regcache (along with
anything else that might prove useful - old regcache, struct_addr, bp
addr :-).

> Hmm, in that case it's probably an even better
> idea to actually set the frame pointer register to the top-of-stack in
> i386_save_dummy_frame_tos(). That way, we won't have a problem when
> there are several frameless function calls in a row. Is writing into
> current_regcache acceptable?

Shouldn't the push arguments code have already adjusted the FP?

Anyway, regardless, you want to add frame_align() to the i386
architecture vector. It forces a non-empty correctly aligned dummy
frame (thus eliminating the frameless dummy frame problem) (but read the
comments that go with the call).

>
> While the TOS in save_dummy_frame_tos() might have once stood for
> top-of-stack, there isn't anything saying that it has to be the stack
> top. A better name for tha functioin's successor would be
> save_dummy_frame_id()
>
> Agreed.

Andrew