I have been playing around with some debugging and wrote some C code that does a lot of pointer related operations (as a Valgrind tool) that runs on top of Valgrind. In the last one hour I changed something as a result of which the program executes fine but then stops responding to Ctrl+C when I try to terminate it.
I tried running the program through gdb and still observing the same behavior. Can someone tell me what triggers this kind of a behavior?
UPDATE: I figured it was infinite recursion that was causing the error but I am still curious as to why it does not respond to the command.
as for How this can happen, when a wishes to actually handle an interrupt, say, to do some cleanup, it will register its own interrupt handler to use instead of the default handler (which usually just calls
exit()orabort()depending on the specific interrupt). If there is a bug in that interrupt, then the handler occurs, but the program doesn’t actually work as expected. Since the only way to kill off the program is by sending it an interrupt, then you can’t kill off the program at all.Well, actually, there is one interrupt you cannot do this with,
SIGKILL. You can’t do anything in your program to prevent it from being handled by immediately callingabort()