This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch v8 15/24] frame, backtrace: allow targets to supply a frame unwinder
- From: Pedro Alves <palves at redhat dot com>
- To: Markus Metzger <markus dot t dot metzger at intel dot com>
- Cc: jan dot kratochvil at redhat dot com, gdb-patches at sourceware dot org
- Date: Fri, 13 Dec 2013 18:27:32 +0000
- Subject: Re: [patch v8 15/24] frame, backtrace: allow targets to supply a frame unwinder
- Authentication-results: sourceware.org; auth=none
- References: <1386839747-8860-1-git-send-email-markus dot t dot metzger at intel dot com> <1386839747-8860-16-git-send-email-markus dot t dot metzger at intel dot com>
On 12/12/2013 09:15 AM, Markus Metzger wrote:
> Allow targets to supply their own target-specific frame unwinders; one for
> normal frames and one for tailcall frames. If a target-specific unwinder
> is supplied, it will be chosen before any other unwinder.
These ...
>
> diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
> index c4f8771..4efa7d8 100644
> --- a/gdb/dwarf2-frame.c
> +++ b/gdb/dwarf2-frame.c
> @@ -1513,16 +1513,16 @@ dwarf2_frame_cfa (struct frame_info *this_frame)
> {
> while (get_frame_type (this_frame) == INLINE_FRAME)
> this_frame = get_prev_frame (this_frame);
> + if (get_frame_unwind_stop_reason (this_frame) == UNWIND_UNAVAILABLE)
> + throw_error (NOT_AVAILABLE_ERROR,
> + _("can't compute CFA for this frame: "
> + "required registers or memory are unavailable"));
> /* This restriction could be lifted if other unwinders are known to
> compute the frame base in a way compatible with the DWARF
> unwinder. */
> if (!frame_unwinder_is (this_frame, &dwarf2_frame_unwind)
> && !frame_unwinder_is (this_frame, &dwarf2_tailcall_frame_unwind))
> error (_("can't compute CFA for this frame"));
> - if (get_frame_unwind_stop_reason (this_frame) == UNWIND_UNAVAILABLE)
> - throw_error (NOT_AVAILABLE_ERROR,
> - _("can't compute CFA for this frame: "
> - "required registers or memory are unavailable"));
> return get_frame_base (this_frame);
> }
> diff --git a/gdb/frame.c b/gdb/frame.c
> index 37d780e..3f2aabb 100644
> --- a/gdb/frame.c
> +++ b/gdb/frame.c
> @@ -2507,13 +2507,10 @@ get_frame_sp (struct frame_info *this_frame)
> enum unwind_stop_reason
> get_frame_unwind_stop_reason (struct frame_info *frame)
> {
> - /* If we haven't tried to unwind past this point yet, then assume
> - that unwinding would succeed. */
> - if (frame->prev_p == 0)
> - return UNWIND_NO_REASON;
> + /* Fill-in STOP_REASON. */
> + get_prev_frame_1 (frame);
> + gdb_assert (frame->prev_p);
>
> - /* Otherwise, we set a reason when we succeeded (or failed) to
> - unwind. */
> return frame->stop_reason;
> }
... parts look a bit unrelated. It'd be good to have
the rationale for this spelled out. I can understand
why they might be necessary, but I don't see why
target vs non-unwinders unwinders would be special here?
--
Pedro Alves