public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Why running the next command will jump back to the previous line position
       [not found] <4EABA71D.600@gmail.com>
@ 2011-10-29  7:56 ` asmwarrior
  2011-10-29 14:17   ` asmwarrior
  0 siblings, 1 reply; 3+ messages in thread
From: asmwarrior @ 2011-10-29  7:56 UTC (permalink / raw)
  To: gcc-help

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<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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why running the next command will jump back to the previous line position
  2011-10-29  7:56 ` Why running the next command will jump back to the previous line position asmwarrior
@ 2011-10-29 14:17   ` asmwarrior
  2011-10-30  8:38     ` 陳韋任
  0 siblings, 1 reply; 3+ messages in thread
From: asmwarrior @ 2011-10-29 14:17 UTC (permalink / raw)
  Cc: gcc-help, gcc

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<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
> 
> 
> 
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why running the next command will jump back to the previous line position
  2011-10-29 14:17   ` asmwarrior
@ 2011-10-30  8:38     ` 陳韋任
  0 siblings, 0 replies; 3+ messages in thread
From: 陳韋任 @ 2011-10-30  8:38 UTC (permalink / raw)
  To: asmwarrior; +Cc: gcc-help, gcc

> 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?

  Maybe you can ask GCC C++ frontend developers (see
${SOURCE}/MAINTAINERS) directly. Perhaps they can tell
you where to start to fix the problem. :-)

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-30  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4EABA71D.600@gmail.com>
2011-10-29  7:56 ` Why running the next command will jump back to the previous line position asmwarrior
2011-10-29 14:17   ` asmwarrior
2011-10-30  8:38     ` 陳韋任

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).