From: asmwarrior <asmwarrior@gmail.com>
To: gdb@sourceware.org
Subject: Why running the next command will jump back to the previous line position
Date: Sat, 29 Oct 2011 07:23:00 -0000 [thread overview]
Message-ID: <4EABA71D.600@gmail.com> (raw)
Hi, I'm using MinGW 4.6.2 and GDB cvs head under Windows XP.
When debugging a sample program: (I build it with -g, and no optimization option is used)
#include <string>
#include <map>
int main()
{
std::map<int, std::string> m;
m[0] = "000";
m[1] = "111";
for( int i = 0; i< 3; i++)
{
m[i] = "ssss";
}
return 0;
}
If I continuously run the command "next" under gdb, I found that when I hit the statement "return 0", if I run "next" again, It will take me backward to the line "std::map<int, std::string> m;". If I run the "next" again, the instruction will go forward the closing bracket of the main function body.
This was quite strange, it looks like the instruction will return to some previous position. (I guess that the destructor of the "std::map" was called.
My question is: This behavior is quite anti-friendly, because if I'm debugging a large function, I always get the instruction line back to where some local variable (automatic variable) was defined.
Is it possible to solve it. I don't want the instruction line go backward when I leave some scope.
Thanks.
asmwarrior
ollydbg from codeblocks' forum
next reply other threads:[~2011-10-29 7:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-29 7:23 asmwarrior [this message]
2011-10-29 7:42 ` Jan Kratochvil
2011-10-29 7:49 ` asmwarrior
2011-10-29 10:39 ` Jan Kratochvil
2011-10-29 14:14 ` 陳韋任
2011-10-29 17:12 ` asmwarrior
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=4EABA71D.600@gmail.com \
--to=asmwarrior@gmail.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