Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: killerbot on June 11, 2011, 01:19:13 pm

Title: breakpoint error on the debugger branch
Post by: killerbot on June 11, 2011, 01:19:13 pm
Code
#include <iostream>

using namespace std;

int main()
{
int x = 0;
while(true)
{
if(x % 10)
{
cout << "Hello world!" << endl;
}
++x;
}
    return 0;
}

* put breakpoint on line 16 [return 0;]
* start debugger
==> it stops twice at line 17 [}]

Code
Active debugger config: GDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Projects\BreakPointTest\
Adding source dir: C:\Projects\BreakPointTest\
Adding file: C:\Projects\BreakPointTest\bin\Debug\BreakPointTest.exe
Changing directory to: C:/Projects/BreakPointTest/.
Starting debugger: C:\MinGW32\bin\gdb.exe -nx -fullname  -quiet -args C:/Projects/BreakPointTest/bin/Debug/BreakPointTest.exe
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.2
Child process PID: 3452
At C:\Projects\BreakPointTest\main.cpp:17
Continuing...
At C:\Projects\BreakPointTest\main.cpp:17
Continuing...

This only happens when there's a breakpoint at that line 16 (I guess, the line before the end). When you remove the breakpoint at line 16, and put it somewhere else, all is fine.
Title: Re: breakpoint error on the debugger branch
Post by: oBFusCATed on June 11, 2011, 01:58:40 pm
What is the raw/debug log looking like?

Also what happens in the trunk version or when you try gdb from command line?

p.s. You can look at the callstack to see if there are more functions above main.
      Sometimes stepping out of the main function goes to other system/runtime functions, but there are no symbols for them and C::B tries to be smart by setting the active frame the one with valid symbols.
Title: Re: breakpoint error on the debugger branch
Post by: ollydbg on June 11, 2011, 02:09:30 pm
@killerbot (http://forums.codeblocks.org/index.php?action=profile;u=655), I can confirm this bug.
The strange thing is the breakpoint was reached before the while loop, and the breakpoint meet twice.
I think it is a gcc error which give wrong symbol/line information. :D