From: Richard Szibele <richard@szibele.com>
To: gdb@sourceware.org
Subject: GDB 7.12.1: Strange "stepping" behavior
Date: Sat, 22 Apr 2017 23:06:00 -0000 [thread overview]
Message-ID: <bdf13d6d-0e0c-a7ce-9ee7-e891c833e6d6@szibele.com> (raw)
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
next reply other threads:[~2017-04-22 23:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-22 23:06 Richard Szibele [this message]
2017-04-23 16:21 ` Simon Marchi
2017-04-23 18:28 ` Richard Szibele
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=bdf13d6d-0e0c-a7ce-9ee7-e891c833e6d6@szibele.com \
--to=richard@szibele.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