public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: gdb@sources.redhat.com
Subject: [RFC] Special type for the sentinel frame?
Date: Sat, 10 May 2003 10:47:00 -0000	[thread overview]
Message-ID: <200305101047.h4AAlUuM037800@elgar.kettenis.dyndns.org> (raw)

Note the comment in the following fragment from sentinel-frame.c:

  const struct frame_unwind sentinel_frame_unwinder =
  {
    /* Should the sentinel frame be given a special type?  */
    NORMAL_FRAME,
    sentinel_frame_this_id,
    sentinel_frame_prev_register
  };

I think the answer to this question is yes.  The following code in
blockframe.c would certainly benefit from it:

  /* return the address of the PC for the given FRAME, ie the current PC value
     if FRAME is the innermost frame, or the address adjusted to point to the
     call instruction if not.  */

  CORE_ADDR
  frame_address_in_block (struct frame_info *frame)
  {
    CORE_ADDR pc = get_frame_pc (frame);

    /* If we are not in the innermost frame, and we are not interrupted
       by a signal, frame->pc points to the instruction following the
       call. As a consequence, we need to get the address of the previous
       instruction. Unfortunately, this is not straightforward to do, so
       we just use the address minus one, which is a good enough
       approximation.  */
    /* FIXME: cagney/2002-11-10: Should this instead test for
       NORMAL_FRAME?  A dummy frame (in fact all the abnormal frames)
       save the PC value in the block.  */
    if (get_next_frame (frame) != 0
	&& get_frame_type (get_next_frame (frame)) != SIGTRAMP_FRAME)
      --pc;

    return pc;
  }

Since the answer to the question in the FIXME would again be yes.
Decreasing PC here would be wrong for sentinel frames in the same way
as it is wrong for dummy frames and signal trampolines.

The reason I bring this to your attention, is that I'm facing a
similar situation in the DWARF CFI frame unwinder.  Of course I can
detect the sentinel frame by looking at the relative frame level.
However, having a seperate frame type for the sentinel frame makes
things cleaner IMHO.

Thoughts?  Andrew?

Mark

             reply	other threads:[~2003-05-10 10:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-10 10:47 Mark Kettenis [this message]
2003-05-10 14:08 ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200305101047.h4AAlUuM037800@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).