[patch rfc] Add the frame's type to the unwinder
Andrew Cagney
ac131313@redhat.com
Sat Apr 5 03:56:00 GMT 2003
> Hello,
>
> The attached patch, moves the frame's type into `struct frame_unwind' and in doing so makes it possible to combine the sequence:
>
> prev->type = frame_type_from_pc()
> prev->unwind = frame_unwind_find_by_pc()
>
> into a single:
>
> prev->unwind = frame_unwind_find_by_pc();
> // prev->type == prev->unwind->type;
>
> and hence eliminate the the call to frame_type_from_pc().
>
>
> Fine print:
>
> While the above is true for new code, old code continues to use the same confused combination of frame_type_from_pc(), frame_unwind_find_by_pc(), deprecated_set_frame_type(), and legacy_get_prev_frame(). A legacy frame's type is initialized to UNKNOWN_FRAME, and then zero or more of those functions will override it. get_frame_type() mapping an UNKNOWN_FRAME onto a NORMAL_FRAME.
>
> Importantly, if a legacy frame's unwinder returns a known frame type (!UNKNOWN_FRAME) then that will be used in preference to any other value. This should make it possible for old architectures to incrementally implement new unwinders.
>
>
> Tested on d10v, ppc, and i386. I'll commit in a few days,
I've checked this in.
Andrew
> 2003-04-02 Andrew Cagney <cagney@redhat.com>
>
> * frame.c (get_prev_frame): Do not call frame_type_from_pc. Set
> the frame's type from the unwinder.
> (get_frame_type): Map UNKNOWN_FRAME onto NORMAL_FRAME.
> (create_new_frame, legacy_get_prev_frame): When the unwinder's
> type isn't UNKNOWN_FRAME, initalize "type" from the unwinder.
> (get_frame_base_address): Use get_frame_type.
> (get_frame_locals_address, get_frame_args_address): Ditto.
> (legacy_saved_regs_unwinder): Set the type to UNKNOWN_TYPE.
> * frame.h (enum frame_type): Add UNKNOWN_FRAME.
> (struct frame_info): Add comment explaining why the frame contains
> a "type" field.
> * dummy-frame.c (dummy_frame_unwind): Set the type to DUMMY_FRAME.
> * d10v-tdep.c (d10v_frame_unwind): Set the type to NORMAL_FRAME.
> * sentinel-frame.c (sentinel_frame_unwinder): Set the type to
> NORMAL_FRAME.
> * frame-unwind.h: Include "frame.h".
> (struct frame_unwind): Add "type" field.
> * Makefile.in (frame_unwind_h): Add $(frame_h).
>
> Inde
More information about the Gdb-patches
mailing list