Re: HEADS UP: converting the i386 to the new frame unwinding stuff

Andrew Cagney
2003-03-04T14:28:02Z

> Date: Mon, 03 Mar 2003 13:45:41 -0500
> From: Andrew Cagney <ac131313@redhat.com>
>
> Mark,
>
> Per several recent discussions, can you create a branch and commit it to
> that. That way I can look at it now (regardless of your intended commit
> schedule)?
>
> Brilliant idea. I still have to comment my code a bit better, but
> I'll try to create that branch somehwere at the end of the week.
>
> I've started writing up the doco and in doing it, I suspect I may have
> found an `off by one' error with the unwinder cache. Having a second
> implementation using the current code should help sort this out.
>
> The current state of affairs seems to work quite well for the i386.
> The only thing that puzzles me is that apparently my
> i386_frame_register_unwind gets called without an initialized cache.
> I was under the impression that we'd always unwind the pc first, and
> since my i386_frame_pc_unwind initialized the cache, I'd always have
> an initialized cache with the other unwind functions.

I think you just hit my off-by-one bug. While I've got get_prev_frame()
doing the sequence:

prev_frame->pc = frame_pc_unwind(next_frame)
..
prev_frame->id = frame_id_unwind(next_frame)

To determine prev_frame's id, prev_frame's prolog needs to have been
analyzed. Contrast that to pc-unwind and register-unwind where the
unwound register value is determined by analyzing next_frame's prologue.
The off by one is that frame id unwind is being handed the wrong cache
:-( (in my defence, I've preserved existing behavour just a bit too
well - explains why the d10v was to easy to convert :-/)

Andrew