Consider the following simple program:-
#include <signal.h>
#include <iostream>
void sighandler(int signum) {
std::cout << "Received signal " << signum << std::endl;
if (signum == 9) exit(42);
}
int main()
{
for (int i = 1; i <= 15; ++i )
signal(i, sighandler);
for(;;) sleep(1);
exit(0);
}
All it does is catch signals and print a message in a console window. If I compile it under Linux (gcc4.2) or under Cygwin (gcc3.4) and run it normally, it works fine. So if I launch the program, click on the console window and press CTRL+C, I see the message
Received signal 2. Both Linux and Cygwin use the gdb debugger and it usually works fine for me. However, if I try to debug this program using C::B, here's what happens:-
LINUX:
The program runs and I click inside its console Window. If I then type CTRL+C, the console window disappears but gdb appears to keep running.
CYGWIN:
The program runs and I click inside its console Window. If I then type CTRL+C, a message appears in the debugger output window saying
Program received signal SIGINT, Interrupt but the signal doesn't get passed to the running program (i.e. if I set a break point in function
sighandler() it never gets reached).
Do I need to enable something within C::B to make this work in such a way that the program works the same way, whether it's running normally or in the debugger?