Signals when debugging Signals when debugging linux linux

Signals when debugging


It turns out the problem had nothing to do with Netbeans or Eclipse, but rather gdb.

gdb can be configured to handle signals in a variety of ways. If you run:

gdb

then type:

info signals

You'll get a list of signals and gdb actions on what to do if it receives that signal:

Signal        Stop      Print   Pass to program  DescriptionSIGHUP        Yes       Yes     Yes              HangupSIGINT        Yes       Yes     No               InterruptSIGQUIT       Yes       Yes     Yes              QuitSIGILL        Yes       Yes     Yes              Illegal instructionSIGTRAP       Yes       Yes     No               Trace/breakpoint trap

etc...

My temporary work around has been to use SIGALRM which gdb defaults to not breaking and sending to the process. However, you can also customise the default gdb settings by creating a .gdbinit file where you can set these


Even this post is old, hope it can help others.

To prevent Eclipse from catching the Ctrl+C, you can configure your gdb using .gbdinit file.You create a .gdinit with this content

#we want Ctrl+C to be no break, pass to application and printed by the debugger handle SIGINT nostophandle SIGINT passhandle SIGINT print

In your eclipse configuration, you can define where is your .gdbinit file to use in your Debug configuration

Eclipse capture


Simple solution.. Try using DEBUG macros to handle your situation.

// Register the signal handler to stop service.#ifdef _DEBUG        signal(SIGKILL, <your signal handler>);#endif

Also, you may try to clean up your app before exiting.