Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* GDB 7.12.1: Strange "stepping" behavior
@ 2017-04-22 23:06 Richard Szibele
  2017-04-23 16:21 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Szibele @ 2017-04-22 23:06 UTC (permalink / raw)
  To: gdb

Hello everyone,

I am experiencing strange stepping behavior with GDB 7.12.1 and a 
program compiled with g++ (GCC) 5.4.0 which I can demonstrate with a 
simple example:


#include <memory>
#include <iostream>

int main()
{
     auto ptr = std::shared_ptr<int>(new int);
     *ptr = 100;
     std::cout << *ptr << std::endl;
     return 0;
}


I've compiled the above with the following g++ flags:

g++ -std=c++14 -g -O0 main.cpp

and then run gdb on the resulting executable.

When I step over using "next" I end up jumping back and forth, rather 
than a simple linear top-down progression in the source code. I've read 
that this is due to compiler optimizations, but as I've supplied the 
flags -g and -O0, I do not believe this should happen.

Is this a bug or am I doing something wrong?

Best Regards,
Richard Szibele


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-23 18:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-22 23:06 GDB 7.12.1: Strange "stepping" behavior Richard Szibele
2017-04-23 16:21 ` Simon Marchi
2017-04-23 18:28   ` Richard Szibele

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox