From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28586 invoked by alias); 29 Oct 2011 14:17:00 -0000 Received: (qmail 28571 invoked by uid 22791); 29 Oct 2011 14:16:58 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MISSING_HEADERS,RCVD_IN_DNSWL_LOW,TW_DB,TW_SM,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-iy0-f175.google.com (HELO mail-iy0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 29 Oct 2011 14:16:44 +0000 Received: by iafi7 with SMTP id i7so6082178iaf.20 for ; Sat, 29 Oct 2011 07:16:44 -0700 (PDT) Received: by 10.231.21.217 with SMTP id k25mr2356784ibb.63.1319897804069; Sat, 29 Oct 2011 07:16:44 -0700 (PDT) Received: from [192.168.1.102] ([115.195.154.122]) by mx.google.com with ESMTPS id jm11sm17317332ibb.1.2011.10.29.07.16.35 (version=SSLv3 cipher=OTHER); Sat, 29 Oct 2011 07:16:43 -0700 (PDT) Message-ID: <4EAC0B83.2010003@gmail.com> Date: Sat, 29 Oct 2011 14:17: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 CC: gcc-help@gcc.gnu.org, "gcc@gcc.gnu.org" Subject: Re: Why running the next command will jump back to the previous line position References: <4EABA71D.600@gmail.com> <4EABB25B.40208@gmail.com> In-Reply-To: <4EABB25B.40208@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg00240.txt.bz2 On 2011-10-29 15:59, asmwarrior wrote: > Hi, I have just a question post on GDB maillist, and some gdb guys thought it was related to GCC. > see: http://sourceware.org/ml/gdb/2011-10/msg00210.html > so I forward my question to this maillist. > > ------------------------------------------------------------------------------ > > 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 > #include > > int main() > { > std::map 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 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 > > > Hi, all. It looks like some one has report a similar bug on: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49951 and it has caused by the revision: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149722 Any GCC developer can have look at it? Thanks. asmwarrior ollydbg from codeblocks' forum