public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: Richard Henderson <rth@redhat.com>
Cc: Andrew Cagney <ac131313@redhat.com>,
	Mark Kettenis <kettenis@chello.nl>,
	mludvig@suse.cz, gdb@sources.redhat.com,
	Alexandre Oliva <aoliva@redhat.com>
Subject: Re: dwarf-frame.c question
Date: Tue, 03 Jun 2003 06:32:00 -0000	[thread overview]
Message-ID: <vt2fzmrpt9b.fsf@zenia.red-bean.com> (raw)
In-Reply-To: <20030603054552.GD19075@redhat.com>

Richard Henderson <rth@redhat.com> writes:

> On Mon, Jun 02, 2003 at 07:03:56PM -0500, Jim Blandy wrote:
> >     The DW_CFA_GNU_unwind_from_noreturn instruction indicates that the
> >     current set of rules applies only when the current location was
> >     reached by unwinding a frame called by this one, not when it was
> >     reached from elsewhere in the subroutine.
> > 
> >     The DW_CFA_GNU_unwind_from_noreturn instruction also creates a new
> >     table row whose location value is the same as this one; this
> >     latter row applies when the given location was reached from
> >     elsewhere in the same subroutine.
> 
> So the effect would be that in the "normal" case we'd continue
> evaluating CFA opcodes as usual until we get to an advance that
> moves past the PC.
> 
> The debugger, on the other hand, would have to know that we are
> unwinding from deeper in the call stack, and set a special flag
> that would stop at the new note?

Yeah, that's the idea.

But I did think of a simpler way to fix this, which wouldn't require
any new Dwarf at all:

Since we're unwinding a frame which will never really be unwound, we
can have that do anything we want.  So, if a function never returns,
why not have the compiler emit CFI that restores the state just
*before* the call insn was executed, not after it returns?  The
unwound PC would point at the call insn itself.  (That's what the user
expects to see anyway.)  The other registers would be as appropriate
before the call was made.  You unwind from there as usual.

I feel like I'm missing something.  Does the compiler have enough info
to do this?  ("No, the compiler doesn't really have enough info to
emit CFI at all, but we do our best, and that's usually okay"?)

It would be weird if you used "return" to artificially pop the frame
and continue.  But that's a bogus thing to do anyway --- the return
address is garbage, so who knows where you're resuming?  If the
function ends with a "call" to 'abort', followed by no more code, then
"return" might just start running at the entry point of the next
function, for goodness' sake.  None of the proposals here will make
that do something sensible, so is this behavior really any more wrong?

  reply	other threads:[~2003-06-03  6:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-27 15:19 Michal Ludvig
2003-05-29 15:44 ` Mark Kettenis
2003-05-29 19:54   ` Andrew Cagney
2003-05-29 22:22     ` Mark Kettenis
2003-05-29 22:43       ` Michal Ludvig
2003-05-29 23:13       ` Andrew Cagney
2003-05-30  1:34         ` Daniel Jacobowitz
2003-05-30 20:21         ` Jim Blandy
2003-05-30 20:21         ` Jim Blandy
2003-05-30 20:32           ` Andrew Cagney
2003-06-03  0:04             ` Jim Blandy
2003-06-03  5:47               ` Richard Henderson
2003-06-03  6:32                 ` Jim Blandy [this message]
2003-06-03 15:58                   ` Richard Henderson
2003-06-03 17:38                     ` Richard Henderson
2003-06-03 20:12                   ` Alexandre Oliva
2003-05-30 20:44           ` Alexandre Oliva
2003-06-01  5:59 Richard Henderson
2003-06-01 10:00 ` Mark Kettenis
2003-06-02 20:34   ` Richard Henderson

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=vt2fzmrpt9b.fsf@zenia.red-bean.com \
    --to=jimb@redhat.com \
    --cc=ac131313@redhat.com \
    --cc=aoliva@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=kettenis@chello.nl \
    --cc=mludvig@suse.cz \
    --cc=rth@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).