How to prevent gdb to send Interrupt signals to child processes

Hi,

I have a program which invokes child processes and communicates with the processes. When I run the program under gdb and say interrupt, all the child processes are dying. Here I am not interested in debugging the child processes. But I don't want my child processes to be killed as my parent process dies as soon as the child process is killed. Also I have no access to the child process code for any modifications. My assumption is that gdb sends interrupt signals to child processes because of which they are dying (but I am not sure about this).

I have tried "handle sigint nopass" on gdb. But it did not work for me.Please let me know if there is any way to prevent gdb to send interrupt signals to child processes.

Thanks in advance,
klnarayana

The children should terminate when the parent does. If the children die, the parent normally gets notified with a SIGCHLD signal. However, by default, this signal is ignored.It could be in your code you are trying to handle it or have reset it to terminate your own process. Look for SIGCHLD in your code.

You should also tell your own process to handle or ignore SIGINT so that your process doesn't get killed when CTRL-C is hit. Try adding this early in the initialization of your program:

signal(SIG_IGN, SIGINT);

Hi,

Thanks for your help.

My parent process just provides me the gui to interact with the child process. Hence I am not bothered about my parent process dying. However I am very much interested in cotrolling my child process through the parent process.

My parent process launches xterm window through which I can communicate with my child process. So when I say interrupt through gdb, the signal is being sent to xterm window. The xterm window is not able to handle the interrupt signal and hence dying. Here I have no control over xterm window or my child process.

Can you suggest me some other solution which can be implemented from parent process or from gdb side?

Thanks once again for the reply.

Regards,
lakshminarayana