From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4782 invoked by alias); 29 Oct 2011 07:08:36 -0000 Received: (qmail 4770 invoked by uid 22791); 29 Oct 2011 07:08:33 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_DB,T_TO_NO_BRKTS_FREEMAIL 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:08:20 +0000 Received: by iagf6 with SMTP id f6so6597196iag.0 for ; Sat, 29 Oct 2011 00:08:19 -0700 (PDT) Received: by 10.42.159.72 with SMTP id k8mr8504150icx.14.1319872099632; Sat, 29 Oct 2011 00:08:19 -0700 (PDT) Received: from [192.168.1.102] ([115.195.154.122]) by mx.google.com with ESMTPS id l28sm15884261ibc.3.2011.10.29.00.08.13 (version=SSLv3 cipher=OTHER); Sat, 29 Oct 2011 00:08:18 -0700 (PDT) Message-ID: <4EABA71D.600@gmail.com> Date: Sat, 29 Oct 2011 07:23: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: gdb@sourceware.org Subject: Why running the next command will jump back to the previous line position 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/msg00210.txt.bz2 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