1837651 Members
3034 Online
110117 Solutions
New Discussion

signal handling in gdb

 
Nandan gogate
Occasional Contributor

signal handling in gdb

 
1 REPLY 1
Nandan gogate
Occasional Contributor

Re: signal handling in gdb

I have an application where I make use of the SIGUSR1 signal. I want to set a beak point in the signal handler. Somehow gdb is not able to handle it. After an application receives a signal for the first time gdb just hangs or terminates the process. In general breakpoint and signals dont work right in gdb.

I have a simple program in which I want to stop in the signal handler. I have tried with all the options like pass/nopass, stop/nostop for SIGUSR1. Thanks for the help

I am using

Hewlett-Packard Wildebeest 1.2.01 (based on GDB 4.17-hpwdb-980821)

HP-UX 11.0

Here is the program

#include
#include
#include
void sighdl(int sig);


void sighdl(int sig)
{
printf("In signal handler sig: %dn",sig);
}

main()
{
printf("In main prog settting the signal n");
signal(SIGUSR1,sighdl);
printf("Waiting to get the signaln");
while(1)
{
int err = sleep(5);
if(err != 0 ) {
printf("interrupted slee, continuing n");
signal(SIGUSR1,sighdl);
}
}
}


One more thing

If you kill the current running process in gdb using kill, to start all over again, it leaves processes. How to get rid of these defunc processes ?