Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "André Pönitz" <andre.poenitz@nokia.com>
To: gdb@sourceware.org
Subject: Re: Getting pissed off by gdb. Please help with stepping in.
Date: Thu, 18 Mar 2010 14:06:00 -0000	[thread overview]
Message-ID: <201003181506.15964.andre.poenitz@nokia.com> (raw)
In-Reply-To: <20100318133334.GA7732@caradoc.them.org>

On Thursday 18 March 2010 14:33:37 Daniel Jacobowitz wrote:
> On Thu, Mar 18, 2010 at 12:22:20AM -0700, Doug Evans wrote:
> > This patch for cvs head gets things working for me.  I haven't run it
> > through the testsuite, and it might be nice compare more than just
> > frame ids (and for the gdb crowd, yes, the FIXME needs to go before
> > being checked in ...), but .... this patch seems otherwise reasonable
> > to me.  At the point where the patch is applied gdb has already
> > decided to continue - what's a case where it *should* continue at this
> > point *if* the frame has changed?  [Note that gdb has already handled
> > various cases like stopping in trampolines and such.]
> 
> In addition to what Eli said... here's the previous block:
> 
>   if ((stop_pc == stop_pc_sal.pc)
>       && (ecs->event_thread->current_line != stop_pc_sal.line
>           || ecs->event_thread->current_symtab != stop_pc_sal.symtab))
>     {
>       /* We are at the start of a different line.  So stop.  Note that
>          we don't stop if we step into the middle of a different line.
>          That is said to make things like for (;;) statements work
>          better.  */
> 
> IOW, if we are at a line boundary, we stop stepping.  If we've ended
> up in the middle of a line, we keep going.  This prevents us from
> ending up in a weird state where we show the line containing the
> function call, but the function has already been called.  I think it'd
> be even more confusing.

Since this code turns up in discussion: The condition fires back in case
of an ill-behaved remote stub.

I unfortunately have to care for such a beast that sometimes "overshoots" 
when stepping over a range by two or three instructions. In this case the
condition is false and gdb will execute the code below the the block
leading to

  keep_going (ecs);

This means a 'next' effectively jumps over two lines, which is rather nasty.
So I have been removing this optimization in gdb for a while (as the stub 
is not under my control) without experiencing any bad side effects. Most
notably, stepping over  for (;;) does not seem to be affected at all.

I understand the (for me unfortunate) gdb behaviour  this is entirely the 
fault of the stub, but nevertheless I wonder whether this optimization is
really needed.

I dug a bit in gdb's history, and the code is older than anything I could 
access, i.e. before 1991 or so.  Together with the comment "That is said 
to make things like for (;;) statements work better" one might get the 
impression that it was a workaround for some particular compiler or such.

Does anybody happen to remember what triggered the inclusion of this
optimization into gdb code?

Andre'


  reply	other threads:[~2010-03-18 14:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18  2:39 temp
2010-03-18  3:00 ` Hui Zhu
2010-03-18  3:03 ` Nathan Froyd
2010-03-18  7:22 ` Doug Evans
2010-03-18  9:07   ` Eli Zaretskii
2010-03-18 15:10     ` Doug Evans
2010-03-18 15:21       ` Pedro Alves
2010-03-18 18:33         ` Eli Zaretskii
2010-03-18 18:55           ` Pedro Alves
2010-03-18 19:38             ` Eli Zaretskii
2010-03-18 19:54               ` Mark Kettenis
2010-03-18 20:43                 ` Doug Evans
2010-03-18 20:51                   ` Michael Snyder
2010-03-18 21:17                     ` Pedro Alves
2010-03-18 21:12                 ` Eli Zaretskii
2010-03-18 23:37                 ` Paul Hilfinger
2010-03-19  9:51                 ` Richard Earnshaw
2010-03-19 10:41                   ` Mark Kettenis
2010-03-19 13:19                     ` Eli Zaretskii
2010-03-19 10:19                 ` André Pönitz
2010-03-18 15:28       ` Doug Evans
2010-03-18 18:31       ` Eli Zaretskii
2010-03-18 18:37         ` Paul Koning
2010-03-18 19:06           ` Doug Evans
2010-03-18 20:48             ` Jonas Maebe
2010-03-18 13:33   ` Daniel Jacobowitz
2010-03-18 14:06     ` André Pönitz [this message]
2010-03-18 14:13       ` Daniel Jacobowitz
2010-03-18 14:33         ` André Pönitz
2010-03-18 14:39           ` Daniel Jacobowitz
2010-03-18 14:54             ` André Pönitz
2010-03-18 15:40     ` Doug Evans
2010-03-18 17:41   ` Michael Snyder
2010-03-18 22:44 ` temp

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=201003181506.15964.andre.poenitz@nokia.com \
    --to=andre.poenitz@nokia.com \
    --cc=gdb@sourceware.org \
    /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