I am using CodeBlocks 17.12 bundled with MingGW: GDB 7.11.1, mingw32-gcc 5.1.0, and mingw32-g++ 5.1.0.
When setting a breakpoint while the program is running I get a SIGTRAP signal. I am able to continue past the breakpoint and hit it multiple times. When I remove the breakpoint, the program still stops on the same line with a SIGTRAP. On the next continue it stops with a SIGILL and I am no longer able to continue.
Breakpoint is set on line 9, the cout line:
#include <iostream>
using namespace std;
int main()
{
for(int i = 0; i < 65000; i++)
{
cout << "Hello world!" << endl;
}
return 0;
}
Debugger Output in CodeBlocks:
Trying to interrupt process with pid: 19600; child pid: 19600 gdb pid: 20264
Continuing...
Program received signal SIGTRAP, Trace/breakpoint trap.
At C:\Users\twalczak\Desktop\test\main.cpp:9
Continuing...
At C:\Users\twalczak\Desktop\test\main.cpp:9
Continuing...
At C:\Users\twalczak\Desktop\test\main.cpp:9
Continuing...
At C:\Users\twalczak\Desktop\test\main.cpp:9
Continuing...
At C:\Users\twalczak\Desktop\test\main.cpp:9
Continuing...
At C:\Users\twalczak\Desktop\test\main.cpp:9
PC register is not available <-- 'Breakpoint removed at this point'
Continuing...
Program received signal SIGTRAP, Trace/breakpoint trap.
At C:\Users\twalczak\Desktop\test\main.cpp:9
Continuing...
Program received signal SIGILL, Illegal instruction.
At C:\Users\twalczak\Desktop\test\main.cpp:9
EDIT Removed bundled because I was using a custom MinGW install, not the bundled install.