From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21397 invoked by alias); 29 Oct 2011 07:42:52 -0000 Received: (qmail 21389 invoked by uid 22791); 29 Oct 2011 07:42:50 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_BJ,TW_DB,TW_SM X-Spam-Check-By: sourceware.org Received: from mail-iy0-f169.google.com (HELO mail-iy0-f169.google.com) (209.85.210.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 29 Oct 2011 07:42:36 +0000 Received: by iagf6 with SMTP id f6so6624358iag.0 for ; Sat, 29 Oct 2011 00:42:36 -0700 (PDT) Received: by 10.42.147.196 with SMTP id o4mr8675155icv.33.1319874156128; Sat, 29 Oct 2011 00:42:36 -0700 (PDT) Received: from [192.168.1.102] ([115.195.154.122]) by mx.google.com with ESMTPS id z10sm15963945ibv.9.2011.10.29.00.42.31 (version=SSLv3 cipher=OTHER); Sat, 29 Oct 2011 00:42:35 -0700 (PDT) Message-ID: <4EABAF25.7060605@gmail.com> Date: Sat, 29 Oct 2011 07:49:00 -0000 From: asmwarrior User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: Jan Kratochvil CC: gdb@sourceware.org Subject: Re: Why running the next command will jump back to the previous line position References: <4EABA71D.600@gmail.com> <20111029072237.GA3977@host1.jankratochvil.net> In-Reply-To: <20111029072237.GA3977@host1.jankratochvil.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00212.txt.bz2 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 >> called. > > yes, objdump -dSC shows there: > > std::map 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::allocator > >::~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 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 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 > anyway. > I'm not quite sure what DW_LNS_negate_stmt means, any way, I will forward my question to GCC maillist. Thanks. asmwarrior ollydbg from codeblocks' forum