From: Pedro Alves <pedro@codesourcery.com>
To: gdb@sourceware.org, Eli Zaretskii <eliz@gnu.org>
Cc: dje@google.com, temp@sourceboost.com
Subject: Re: Getting pissed off by gdb. Please help with stepping in.
Date: Thu, 18 Mar 2010 18:55:00 -0000 [thread overview]
Message-ID: <201003181855.39643.pedro@codesourcery.com> (raw)
In-Reply-To: <8339zxv5tp.fsf@gnu.org>
On Thursday 18 March 2010 18:32:34, Eli Zaretskii wrote:
> > > (gdb) f
> > > #0 bar () at stepout.c:4
> > > 4 int bar () { return 1; }
> > > (gdb) s
> > > main () at stepout.c:12
> > > 12 return 0;
> > > (gdb)
> > >
> > > Note that we've stepped out of bar, into foo, and back out of foo.
> >
> > He most probably used "next" when he said:
> >
> > > I do a step out and wtf... Instead of getting back to the line
> > > where 'foo' is called I get passed it.
>
> I would expect "next" on line 4 to behave the same as "step", since
> there's no function call there.
But it doesn't. You're missing the issue. "step" on line 4 will
take you to line 6, instead of line 11, because GDB keeps stepping
after returning from bar (because it landed in the middle
of line 11, and we don't stop there when stepping/nexting).
Next on line 4 will take you to line 12, instead of line 11,
because GDB keeps stepping after returning from bar (because
it landed in the middle of line 11, and we don't stop there
when stepping/nexting).
Users often find this behaviour unexpected (I've often
wished GDB would behave like what the OP is suggesting too).
In the example being discussed, the OP would have expected
that GDB would stop at line 11, when "stepping out of bar",
but found GDB stopping at line 12 instead. I was saying that
what he was probably calling "stepping", was issueing enough
"next"s to step out of bar, not "step"s. I don't suppose
people wanting to step out of a function (not knowing about
finish) would issue "(gdb) step"s and risk stepping
into further nested functions...
I was pointing that out, after reading Doug's:
> "I agree it should work as you expect. I don't see the step out of bar
> continuing passed foo, but I do see it stepping into foo (as if you
> had done two steps, so to speak: step out of bar and step into foo).
> [This is with gdb 7.0 and cvs head.]"
So, I'm merely saying that to reproduce what the OP was saying,
you should do "next" to step out of bar, not "step".
Visual Studio's "Step (Over)" ==> "(gdb) next"
Visual Studio's "Step Into" ==> "(gdb) step"
In any case, the behaviour would not be what the OP expected.
--
Pedro Alves
next prev parent reply other threads:[~2010-03-18 18:55 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 [this message]
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
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=201003181855.39643.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=dje@google.com \
--cc=eliz@gnu.org \
--cc=gdb@sourceware.org \
--cc=temp@sourceboost.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