This is the mail archive of the
mailing list for the GDB project.
Re: Why running the next command will jump back to the previous line position
- From: asmwarrior <asmwarrior at gmail dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb at sourceware dot org
- Date: Sat, 29 Oct 2011 15:45:41 +0800
- Subject: Re: Why running the next command will jump back to the previous line position
- References: <4EABA71D.email@example.com> <20111029072237.GA3977@host1.jankratochvil.net>
On 2011-10-29 15:22, Jan Kratochvil wrote:
> On Sat, 29 Oct 2011 09:11:25 +0200, asmwarrior wrote:
>> 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
> yes, objdump -dSC shows there:
> std::map<int, std::string> m;
> 400bab: 48 8d 45 b0 lea -0x50(%rbp),%rax
> 400baf: 48 89 c7 mov %rax,%rdi
> 400bb2: e8 43 00 00 00 callq 400bfa<std::map<int, std::string, std::less<int>, std::allocator<std::pair<int const, std::string> > >::~map()>
> 400bb7: 89 d8 mov %ebx,%eax
Hi, thanks for the reply, I just run the objdump -dSC a.exe under Windows, and I found the similar content.
So, it looks like the line "std::map<int, std::string> m;" associates many instruction pieces. Those pieces include the calling of the std::map's destructor.
When leaving the main function body, the instruction piece of the destructor will reached, and gdb just refer to the declaration line. So that gdb put the current source line back to "std::map<int, std::string> m;" again.
My explanation is right?
>> My question is: This behavior is quite anti-friendly,
> Maybe GCC could produce there DW_LNS_negate_stmt so that the variable
> declaration line is still shown in backtraces (if the destructor crashes) but
> it is skipped over during stepping/nexting; but GDB currently would not show
> such line in backtraces, GCC currently does not produce DW_LNS_negate_stmt
I'm not quite sure what DW_LNS_negate_stmt means, any way, I will forward my question to GCC maillist.
ollydbg from codeblocks' forum