Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: Donn Terry <donnte@microsoft.com>
Cc: Michael Snyder <msnyder@redhat.com>, gdb-patches@sources.redhat.com
Subject: Re: Single step vs. "tail recursion" optimization
Date: Wed, 13 Nov 2002 09:43:00 -0000	[thread overview]
Message-ID: <vt27kfhs7l9.fsf@zenia.red-bean.com> (raw)
In-Reply-To: <3DCC4497.1FC39237@redhat.com>


Michael Snyder <msnyder@redhat.com> writes:
> Donn Terry wrote:
> > 
> > (I'm sorry to have to be the messenger on this one...)
> > 
> > Here's a mini testcase.  I've also attached the resulting .s files for
> > -O2 and -O3.
> 
> You do know, don't you, that there are lots of optimizations that GDB
> fails to debug at -O2 and -O3?  If something bad happens at those 
> levels, our practice is to say "turn down the optimization and try again".

Yeah, in general there's no way for GDB to produce the expected
backtrace when the compiler has turned a call in tail position into a
pop-frame-and-jump.  There's simply no record at all of the function
that made the tail call on the stack.

But when there's a tail call to a function with no debug info, it
seems to me that GDB should still do better than just letting the
program run away.  When "step" or "next" notice that they've stepped
into a new function which has no debug info, they're supposed to set a
breakpoint at the return address and run until that's hit.  Now, in
the presence of tail call optimizations, that return address is going
to be one (or more) stack frames further back than you expect, but it
should still get hit eventually.  In your program, that breakpoint
should be set in main, I think.  Doesn't that work?


  reply	other threads:[~2002-11-13 17:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-08 13:57 Donn Terry
2002-11-08 15:11 ` Michael Snyder
2002-11-13  9:43   ` Jim Blandy [this message]
2002-11-13 19:44 ` Andrew Cagney
  -- strict thread matches above, loose matches on Subject: below --
2002-11-13  9:52 Donn Terry
2002-11-07 11:18 Donn Terry
2002-11-07 17:04 ` Andrew Cagney
2002-11-08 11:43 ` Michael Snyder

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=vt27kfhs7l9.fsf@zenia.red-bean.com \
    --to=jimb@redhat.com \
    --cc=donnte@microsoft.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@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